| chgrp | |
|---|---|
Example usage of chgrp command to change the files' groups | |
| Developer | AT&T Bell Laboratories |
| Initial release | May 1975; 50 years ago (1975-05) |
| Written in | Plan 9:C |
| Operating system | Unix,Unix-like,Plan 9,Inferno,IBM i |
| Platform | Cross-platform |
| Type | Command |
| License | Plan 9:MIT License |
chgrp, short forchangegroup, is ashellcommand for changing thegroup associated with aUnix-basedfile systemfile – including special files such asdirectories. Changing the group of a file is restricted to a super-user (such as viasudo) or to the file's owning user if the user is in the specified group.
A file has accesspermissions for the owning user, a group and for others. Changing the group for a file changes access to it based on users' group memberships.
Thechgrp command was originally developed as part of theUnix operating system byAT&T Bell Laboratories. It is available in mostUnix-like systems,Plan 9,Inferno andIBM i.[1]
The version ofchgrp bundled inGNUcoreutils was written by David MacKenzie.[2]
Generally, the syntax can be described as:
chgrp [options]groupfiles
*.confOptions:
-RRecurse through directories-vVerbose output: log the name of each file changed-fForce orforge ahead even if an error occursThe following demonstrates changing the group of files matching*.conf tostaff – provided the user owns the files (isgbeeker) and is a member ofstaff. The change will allow members of the groupstaff to modify the files since the group-class permissions (read/write) will apply, not the others-class permissions (read only).
$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$chgrpstaff*.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
chgrp: change the file group ownership – Shell and Utilities Reference,The Single UNIX Specification, Version 5 fromThe Open Groupchgrp(1) – Plan 9 Programmer's Manual, Volume 1chgrp(1) – Inferno General commandsManual