logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/

ln.1 (1913B)


  1. .\" utils-std: Collection of commonly available Unix tools
  2. .\" Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. .\" SPDX-License-Identifier: MPL-2.0
  4. .Dd January 22, 2025
  5. .Dt LN 1
  6. .Os
  7. .Sh NAME
  8. .Nm ln
  9. .Nd create hard links and symbolic links
  10. .Sh SYNOPSIS
  11. .Nm
  12. .Op Fl fnv
  13. .Op Fl L Ns | Ns Fl P
  14. .Fl T
  15. .Ar source
  16. .Ar target
  17. .Nm
  18. .Op Fl fnv
  19. .Op Fl L Ns | Ns Fl P
  20. .Ar source...
  21. .Op Ar target
  22. .Nm
  23. .Op Fl fnrv
  24. .Fl Ts
  25. .Ar reference
  26. .Ar target
  27. .Nm
  28. .Op Fl fnrv
  29. .Fl s
  30. .Ar reference...
  31. .Op Ar target
  32. .Sh DESCRIPTION
  33. .Nm
  34. create links at
  35. .Ar target
  36. for each given
  37. .Ar source
  38. or
  39. .Ar reference .
  40. .Pp
  41. Unless
  42. .Fl T
  43. is passed, when
  44. .Ar target
  45. is an existing directory or multiple
  46. .Ar source
  47. or
  48. .Ar reference
  49. are given,
  50. .Nm
  51. will create links into
  52. .Ar target .
  53. If
  54. .Ar target
  55. is unspecified, then it is set to the current directory, as if
  56. .Qq \&.
  57. would have been passed.
  58. .Pp
  59. Should be noted that unlike commands like
  60. .Xr cp 1 ,
  61. .Ar reference
  62. is kept as is and therefore is always relative to
  63. .Ar target
  64. rather than the current directory.
  65. .Sh OPTIONS
  66. .Bl -tag -width __
  67. .It Fl f
  68. Forcefully create links by removing existing entries.
  69. .It Fl L
  70. If
  71. .Ar source
  72. is a symbolic link, dereference it.
  73. .It Fl n
  74. Prevent descending into
  75. .Ar target
  76. as a directory if it is a symbolic link.
  77. .It Fl P
  78. If
  79. .Ar source
  80. is a symbolic link, hard link it.
  81. This is the default.
  82. .It Fl r
  83. No-op when
  84. .Fl s
  85. isn't passed, otherwise turns each
  86. .Ar reference
  87. into a relative path.
  88. .It Fl s
  89. Create symbolic links instead of hard links.
  90. .It Fl T
  91. Always treat
  92. .Ar target
  93. as a normal file.
  94. .It Fl v
  95. Print successfully created links.
  96. .El
  97. .Sh EXIT STATUS
  98. .Ex -std
  99. .Sh STANDARDS
  100. .Nm
  101. should be compliant with the
  102. IEEE Std 1003.1-2024 (“POSIX.1”)
  103. specification.
  104. The
  105. .Fl n ,
  106. .Fl T ,
  107. .Fl r ,
  108. and
  109. .Fl v
  110. options are extensions.
  111. Support for unspecified
  112. .Ar target
  113. is an extension.
  114. .Sh AUTHORS
  115. .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me