chgrp
![]() Example usage of chgrp command to change the files' groups | |
Developer(s) | AT&T Bell Laboratories |
---|---|
Initial release | May 1975 |
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 |
Thechgrp(fromchangegroup)commandmay be used byunprivilegedusers on variousoperating systemsto change thegroupassociated with afile systemobject (such as acomputer file,directory,or link) to one of which they are a member. A file system object has 3 sets of access permissions, one set for the owner, one set for the group and one set for others. Changing the group of an object could be used to change which users can write to a file.
History
[edit]Thechgrpcommand was originally developed as part of theUnixoperating system byAT&T Bell Laboratories.
It is also available in thePlan 9andInfernooperating systems and in mostUnix-likesystems.
Thechgrpcommand has also been ported to theIBM ioperating system.[1]
The version ofchgrp
bundled inGNUcoreutilswas written by David MacKenzie.[2]
Syntax
[edit]chgrp [options]groupFSO
- Thegroupparameter specifies the new group with which the files or directories should be associated. It may either be a symbolic name or anidentifier.
- TheFSOspecifies one or more file system objects, which may be the result of aglobexpression like*.conf.
Frequently implemented options
[edit]-Rrecurse through subdirectories.
-vverbosely output names of objects changed. Most useful when"FSO"is a list.
-fforce or forge ahead with other objects even if an error is encountered.
Example
[edit]$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
The above command changes the group associated with fileprog.conffromwheeltostaff(provided the executing user is a member of that group). This could be used to allow members of staff to modify the configuration for programsprogandprox.
See also
[edit]References
[edit]External links
[edit]![](https://upload.wikimedia.org/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/40px-Wikibooks-logo-en-noslogan.svg.png)
- The Single UNIX Specification,Version 4 fromThe Open Group :change the file group ownership – Shell and Utilities Reference,
- Plan 9Programmer's Manual, Volume 1 –
- InfernoGeneral commandsManual –