chgrp

change file group ownership (POSIX)

Syntax:

chgrp [-R] group file...

Options:

-R
Recursively change group ownership of files. For each file that names a directory, chgrp changes the group of the directory and of all files in the file hierarchy below it.
group
A group name from the group database, or a numeric groupid.
file
The pathname of a file whose groupid is to be modified.

Examples:

Change file group of myfile to 27:

chgrp 27 myfile

Change file group of myfile to technical:

chgrp technical myfile

Description:

The chgrp utility lets you change the group ownership of one or more files. For each file you name, chgrp sets the file's group ID to the groupid specified by the group operand.

If you invoke chgrp with the -R option, and chgrp attempts but fails to change the groupid of a particular file in a specified file hierarchy, it continues to process the remaining files in the hierarchy. The chgrp utility can fail to change the groupid of a file if you don't have appropriate permissions.

Exit status:

0
The utility executed successfully and all requested changes were made.
>0
An error occurred.

Files:

/etc/groups
This file defines the known groupids for the system. It associates group names with a numerical ID and a list of usernames who are members of the group.

Entries in this file appear in the following format:

groupname:unused:groupid:user[,user]...

See also: