Linux and Unix chgrp command

Quick links

About chgrp
Syntax
Examples
Linux and Unix main page

About chgrp

For system V, changes the group that has access to a file or directory.

Syntax

chgrp newgroup filenames [-f] [-h]

newgroupSpecifies the new group that you wish to allow access to.
filenamesSpecifies the files that the newgroup has access to.
-fForce. Do not report errors.
-hIf the file is a symbolic link, change the group of the symbolic link. Without this option, the group of the file referenced by the symbolic link is changed.
-RRecursive. chgrp descends through the directory, and any subdirectories, setting the specified group ID as it proceeds. When a symbolic link is encountered, the group of the target file is changed (unless the -h option is specified), but no recursion takes place.

Examples

chgrp hope file.txt

Change the group to hope for the file file.txt if present and the group hope is valid.

Related commands

chmod
chown
id