Chgrp
, short for change group, is a shell command for changing the group associated with a Unix-based file system file including special files such as directories. Changing the group of a file is restricted to a super-user or to the file's owning user if the user is in the specified group.
A file has access permissions for the owning user, a group and for others. Changing the group for a file changes access to it based on users' group memberships.
History
The command was originally developed as part of the Unix operating system by AT&T Bell Laboratories. It is available in most Unix-like systems, Plan 9, Inferno and IBM i.The version of
chgrp bundled in GNU coreutils was written by David MacKenzie.Use
Generally, the syntax can be described as:chgrp group ''files
- Recurse through directories
- Verbose output: log the name of each file changed
- Force or forge ahead even if an error occurs
Examples
$ ls -l *.conf
-rw-rw-r-- 1 gbeeker wheel 3545 Nov 04 2011 prog.conf
-rw-rw-r-- 1 gbeeker wheel 3545 Nov 04 2011 prox.conf
$ chgrp staff *.conf
$ ls -l *.conf
-rw-rw-r-- 1 gbeeker staff 3545 Nov 04 2011 prog.conf
-rw-rw-r-- 1 gbeeker staff 3545 Nov 04 2011 prox.conf