Chgrp

Shell command for changing the group of a file


title: "Chgrp" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["operating-system-security", "standard-unix-programs", "unix-sus2008-utilities", "plan-9-commands", "inferno-(operating-system)-commands", "ibm-i-qshell-commands"] description: "Shell command for changing the group of a file" topic_path: "technology/operating-systems" source: "https://en.wikipedia.org/wiki/Chgrp" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0

::summary Shell command for changing the group of a file ::

::data[format=table title="Infobox software"]

FieldValue
namechgrp
logo
screenshotChgrp-example-command.gif
captionExample usage of command to change the files' groups
collapsible
developerAT&T Bell Laboratories
released
discontinued
ver layout
latest release date
latest preview date
repo
programming languagePlan 9: C
operating systemUnix, Unix-like, Plan 9, Inferno, IBM i
platformCross-platform
language count
genreCommand
licensePlan 9: MIT License
website
::

| name = chgrp | logo = | logo alt = | logo caption = | screenshot = Chgrp-example-command.gif | screenshot alt = | caption = Example usage of command to change the files' groups | collapsible = | author = | developer = AT&T Bell Laboratories | released = | discontinued = | ver layout = | latest release version = | latest release date = | latest preview version = | latest preview date = | repo = | programming language = Plan 9: C | operating system = Unix, Unix-like, Plan 9, Inferno, IBM i | platform = Cross-platform | size = | language = | language count = | language footnote = | genre = Command | license = Plan 9: MIT License | alexa = | website = | standard = | AsOf =

****, 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 ) 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 [options] group files

  • group specifies the group with which the files should be associated; may be either a symbolic name or an identifier
  • 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).

::code[lang=console] $ 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 ::

References

References

  1. IBM. "IBM System i Version 7.2 Programming Qshell".
  2. {{man. 1. chgrp. Linux

::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::

operating-system-securitystandard-unix-programsunix-sus2008-utilitiesplan-9-commandsinferno-(operating-system)-commandsibm-i-qshell-commands