logo

utils-std

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

chown.1 (2095B)


  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 October 31, 2024
  5. .Dt CHOWN 1
  6. .Os
  7. .Sh NAME
  8. .Nm chown , chgrp
  9. .Nd Change files ownership
  10. .Sh SYNOPSIS
  11. .Nm chown
  12. .Op Fl v
  13. .Op Fl h | Fl R Op Fl HLP
  14. .Ar owner Ns Op : Ns Ar group
  15. .Ar file...
  16. .Nm chown
  17. .Op Fl v
  18. .Op Fl h | Fl R Op Fl HLP
  19. .Fl -reference Ar ref_file
  20. .Ar file...
  21. .Nm chgrp
  22. .Op Fl v
  23. .Op Fl h | Fl R Op Fl HLP
  24. .Ar group
  25. .Ar file...
  26. .Nm chgrp
  27. .Op Fl v
  28. .Op Fl h | Fl R Op Fl HLP
  29. .Fl -reference Ar ref_file
  30. .Ar file...
  31. .Sh DESCRIPTION
  32. .Nm chown
  33. sets the user ID given by
  34. .Ar owner ,
  35. and when given by
  36. .Ar group ,
  37. the group ID on each given
  38. .Ar file .
  39. .Pp
  40. .Nm chgrp
  41. sets the group ID given by
  42. .Ar group
  43. on each given
  44. .Ar file .
  45. .Pp
  46. The
  47. .Ar owner
  48. and
  49. .Ar group
  50. arguments can be either numeric IDs, or names.
  51. Unless specified, ownership refers to both user and group.
  52. .Pp
  53. If
  54. .Fl -reference
  55. is used instead
  56. .Nm chown
  57. sets both user and group ownership
  58. and
  59. .Nm chmod
  60. sets only group ownership.
  61. .Sh OPTIONS
  62. .Bl -tag -width Ds
  63. .It Fl h
  64. If
  65. .Ar file
  66. is a symbolic link, set it's ownership.
  67. .It Fl H
  68. If
  69. .Fl R
  70. is also specified,
  71. and
  72. .Ar file
  73. refers to a symbolic link itself referring to a directory,
  74. change ownership of the directory and it's children.
  75. .It Fl L
  76. If
  77. .Fl R
  78. is also specified,
  79. and symbolic links referring to directories are found,
  80. change ownership of said directories and their children.
  81. .It Fl P
  82. If
  83. .Fl R
  84. is also specified,
  85. change ownership of symbolic links without dereferencing.
  86. .It Fl R
  87. Recurse into directories.
  88. .It Fl -reference Ar ref_file
  89. Copy ownership from
  90. .Ar ref_file
  91. into each
  92. .Ar file .
  93. .It Fl v
  94. Verbose, print a message about each processed file, whether a change was made or not.
  95. .El
  96. .Sh EXIT STATUS
  97. .Ex -std
  98. .Sh SEE ALSO
  99. .Xr stat 1
  100. .Sh STANDARDS
  101. .Nm
  102. should be compliant with the
  103. IEEE Std 1003.1-2024 (“POSIX.1”)
  104. specification.
  105. .Pp
  106. The
  107. .Fl v
  108. and
  109. .Fl -reference
  110. options are extensions, also present in GNU coreutils.
  111. .Sh AUTHORS
  112. .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me