You are here: >

Linux and Unix chgrp command

chgrp commandAbout chgrp
chgrp syntax
chgrp examples
Linux and Unix main page

About chgrp

Changes group ownership of a file or files.


Change the group of each FILE to GROUP. With --reference, change the group of each FILE to that of RFILE.

chgrp syntax

chgrp [OPTION]... GROUP FILE...
chgrp [OPTION]... --reference=RFILE FILE...


-c, --changes

like verbose but report only when a change is made

-f, --silent, --quiet

suppress most error messages.

-v, --verbose

output a diagnostic for every file processed.


affect the referenced file of each symbolic link, rather than the symbolic link itself. This is the default.

-h, --no-dereference

affect symbolic links instead of any referenced file. This is useful only on systems that can change the ownership of a symlink.


do not treat '/' in any special way. This is the default.


Do not operate recursively on '/'.


use RFILE's group rather than specifying a GROUP value.

-R, --recursive

operate on files and directories recursively.

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:


if a command line argument is a symbolic link to a directory, traverse it.


traverse every symbolic link to a directory.


do not traverse any symbolic links. This is the default.


Display a help message and exit.


output version information and exit.

chgrp 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.

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.