Name

chgrp

Synopsis

    chgrp [options]newgroup files

Change the group of one or more files to newgroup. newgroup is either a group ID number or a group name located in /etc/group. You must own the file or be a privileged user to succeed with this command.

Common Options

-f, --quiet, --silent

Do not print error messages about files that can’t be changed.

-h, --no-dereference

Change the group on symbolic links. Normally, chgrp acts on the file referenced by a symbolic link, not on the link itself.

-R, --recursive

Recursively descend through the directory, including subdirectories and symbolic links, setting the specified group ID as it proceeds. The last of -H, -L, and -P take effect when used with -R.

GNU/Linux and Mac OS X Options

-H

When used with -R, if a command-line argument is a symbolic link to a directory, recursively traverse the directory. In other words, follow the link.

-L

When used with -R, if any symbolic link points to a directory, recursively traverse the directory.

-P

When used with -R, do not follow any symbolic links. This is the default.

-v, --verbose

Verbosely describe ownership changes.

GNU/Linux Options

-c, --changes

Print information about files that are changed.

--dereference

Change the group of the file pointed to by a symbolic link, not the group of the symbolic link itself. This is the default.

--no-preserve-root

Do not treat the root directory, /, specially (the default).

--preserve-root

Do not operate recursively on /, the root directory.

--reference= filename

Change ...

Get Unix in a Nutshell, 4th Edition 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.