Chgrp

Last updated • 1 min readFrom Wikipedia, The Free Encyclopedia
chgrp
Developer(s) AT&T Bell Laboratories
Initial releaseMay 1975;49 years ago (1975-05)
Written inPlan 9: C
Operating system Unix, Unix-like, Plan 9, Inferno, IBM i
Platform Cross-platform
Type Command
License Plan 9: MIT License

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 (such as via sudo) or to the file's owning user if the user is in the specified group.

Contents

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 chgrp 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. [1]

The version of chgrp bundled in GNU coreutils was written by David MacKenzie. [2]

Use

Generally, the syntax can be described as:

chgrp [options] groupfiles

Options:

Examples

The following demonstrates changing the group of files matching *.conf 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$ 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

See also

References

  1. IBM. "IBM System i Version 7.2 Programming Qshell" (PDF). IBM . Archived (PDF) from the original on 2020-09-18. Retrieved 2020-09-05.
  2. chgrp(1)    Linux User Manual – User Commands