chgrp (change group)

Changes the group owner of a file.

Format:    chgrp newgroup filename
Examples:  chgrp janet file27.txt

The file file27.txt now has the group owner janet. Only the owner of the file or the super user can change the group. If you attempt to change the group to a group that doesn't exist, an error message displays.

OptWhat It DoesExample
-cDisplay info about file changes
chgrp -c janet file2
changed group of 'file2' to janet
-RMake changes in all subdirectories
ls -R janet file3
changes file3 in any
subdirectories, as well

Get Spring Into Linux® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.