1. Home
  2. Linux
  3. Linux File Permissions
  4. Linux – chgrp

Linux – chgrp

Linux chgrp command

Linux chgrp command is used for changing the group of the file or directory.

Syntax:

chown <GROUP> [FILE]...

Example:

Set the file group of testfile.txt to group “staff”. Now all the member users of staff group have privileges on file as a group user.

chgrp staff testfile.txt

Change File Ownership Recursively

You can specify option -R to change group recursively to all files in the specified directory an subdirectory. For example, Set the group staff to all files under /home/rahul directory.

chgrp -R staff /home/rahul