Home·Terminal commands

chgrp

Permissions

Usage

chgrp [group] [path]

Changes only a file's group, which chown can also do with :group; unless you are root you may only assign a group you belong to.

Common flags

FlagMeaning
-RApply to a whole tree
-hChange the symlink itself
-vReport each change
--referenceGNU: take the group from another file

Examples

chgrp -R developers /srv/project

Whole tree over to the developers group.

chgrp staff notes.txt

Works only if you belong to staff.

Numeric and symbolic modes name the same thing: 755 and u=rwx,go=rx are the same permission.

How to read this

  • Square brackets [ ] mark a part you may leave out.
  • An ellipsis … means you can list more than one.
  • Flags are case-sensitive — in some commands -r and -R do different things.

Questions

Q. What does chgrp do?

Changes only a file's group, which chown can also do with :group; unless you are root you may only assign a group you belong to.

Q. How do I type it?

chgrp [group] [path] — square brackets mark the parts you can leave out.

Q. How many flags are worth knowing?

4 are listed here; the full set is in man chgrp. This command sits under Permissions.

Related commands

man page: man chgrp