Copied to clipboard

chgrp

chgrp command is used to change the group ownership of a file or directory.

Example

  • Change the group owner of the file file.txt to the staff group:
    chgrp staff file.txt
    
  • Change the group owner of all files in the directory /home/user1/docs/ and its subdirectories to the users group:
    chgrp -R users /home/user1/docs/
    
  • Change the group owner of all files in the directory /home/user1/docs/ and its subdirectories to the users group, and display the process:
    chgrp -vR users /home/user1/docs/
    
  • Change the group owner of the file file.txt to the same group as the reference file file2.txt:
    chgrp --reference=file2.txt file.txt
    
  • Change the group owner of the symbolic link file link itself to the staff group:
    chgrp -h staff link