, short for change group, is a
shell
Shell may refer to:
Architecture and design
* Shell (structure), a thin structure
** Concrete shell, a thin shell of concrete, usually with no interior columns or exterior buttresses
Science Biology
* Seashell, a hard outer layer of a marine ani ...
command for changing the
group associated with a
Unix
Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
-based
file system file including special files such as
directories. Changing the group of a file is restricted to a super-user (such as via ) 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
Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
operating system by
AT&T Bell Laboratories
Nokia Bell Labs, commonly referred to as ''Bell Labs'', is an American industrial research and development company owned by Finnish technology company Nokia. With headquarters located in Murray Hill, New Jersey, Murray Hill, New Jersey, the compa ...
. It is available in most
Unix-like
A Unix-like (sometimes referred to as UN*X, *nix or *NIX) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Uni ...
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
'options''''group'' ''files''
* ''group'' specifies the group with which the files should be associated; may be either a symbolic name or an
identifier
An identifier is a name that identifies (that is, labels the identity of) either a unique object or a unique ''class'' of objects, where the "object" or class may be an idea, person, physical countable object (or class thereof), or physical mass ...
* ''files'' specifies one or more files, which may be the result of a
glob expression like
Options:
* Recurse through directories
* Verbose output: log the name of each file changed
* Force or forge ahead even if an error occurs
Examples
The following demonstrates changing the group of files matching to ''staff'' provided the user owns the files (is ''gbeeker'') and is a member of ''staff''. The change will allow members of the group ''staff'' 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
$ 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
See also
*
*
*
*
References
External links
*
*
*
{{Core Utilities commands
Operating system security
Standard Unix programs
Unix SUS2008 utilities
Plan 9 commands
Inferno (operating system) commands
IBM i Qshell commands
de:Unix-Kommandos#Benutzer- und Rechteverwaltung