On Unix-like operating systems, the chgrp command changes the group ownership of a file or files.
This page covers the GNU/Linux version of chgrp.
Description
The chgrp command changes the group of each FILE to GROUP. If the –reference option is specified, chgrp changes the group of each FILE to that of RFILE.
- Description
- Syntax
- Options
- Examples
- Linux commands help
Syntax
chgrp [OPTION]… GROUP FILE…
chgrp [OPTION]… –reference=RFILE FILE…
Options
The following options modify how a hierarchy is traversed when the -R option is also specified. If more than one of these options is specified, only the final one takes effect:
Examples
chgrp hope file.txt
Change the owning group of the file file.txt to the group named hope.
chgrp -hR staff /office/files
Change the owning group of /office/files, and all subdirectories, to the group staff.
Related commands
chmod — Change the permissions of files or directories.chown — Change the ownership of files or directories.id — Display real and effective user and group IDs.