Jump to content

Chgrp

From Wikipedia, the free encyclopedia

Template:Short description Template:Lowercase title {{#invoke:Infobox|infobox}}Template:Template other {{#invoke:Check for unknown parameters|check|unknown=Template:Main other|preview=Page using Template:Infobox software with unknown parameter "_VALUE_"|ignoreblank=y| AsOf | author | background | bodystyle | caption | collapsetext | collapsible | developer | discontinued | engine | engines | genre | included with | language | language count | language footnote | latest preview date | latest preview version | latest release date | latest release version | latest_preview_date | latest_preview_version | latest_release_date | latest_release_version | licence | license | logo | logo alt | logo caption | logo class | logo size | logo title | logo upright | logo_alt | logo_caption | logo_class | logo_size | logo_title | logo_upright | middleware | module | name | operating system | operating_system | other_names | platform | programming language | programming_language | qid | released | replaced_by | replaces | repo | screenshot | screenshot alt | screenshot class | screenshot size | screenshot title | screenshot upright | screenshot_alt | screenshot_class | screenshot_size | screenshot_upright | service_name | size | standard | title | ver layout | website }}Template:Main other{{#invoke:Check for conflicting parameters|check | template = Template:Infobox software | cat = Template:Main other | logo size; logo_size | logo class; logo_class | logo alt; logo_alt | logo title; logo_title | logo caption; logo_caption | screenshot size; screenshot_size | screenshot upright; screenshot_upright | screenshot class; screenshot_class | screenshot alt; screenshot_alt | screenshot title; screenshot title | latest release version; latest_release_version | latest release date; latest_release_date | latest preview version; latest_preview_version | latest preview date; latest_preview_date | latest release version; latest_release_version | latest release date; latest_release_date | latest preview version; latest_preview_version | latest preview date; latest_preview_date | programming language; programming_language | operating system; operating_system }}

<syntaxhighlight lang="text" class="" style="" inline="1">chgrp</syntaxhighlight>, short for change group, is a shell command for changing the group associated with a Unix-based file system file Template:Endash including special files such as directories. Changing the group of a file is restricted to a super-user (such as via <syntaxhighlight lang="text" class="" style="" inline="1">sudo</syntaxhighlight>) 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 <syntaxhighlight lang="text" class="" style="" inline="1">chgrp</syntaxhighlight> 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] 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 <syntaxhighlight lang="text" class="" style="" inline="1">*.conf</syntaxhighlight>

Options:

  • <syntaxhighlight lang="text" class="" style="" inline="1">-R</syntaxhighlight> Recurse through directories
  • <syntaxhighlight lang="text" class="" style="" inline="1">-v</syntaxhighlight> Verbose output: log the name of each file changed
  • <syntaxhighlight lang="text" class="" style="" inline="1">-f</syntaxhighlight> Force or forge ahead even if an error occurs

Examples

The following demonstrates changing the group of files matching <syntaxhighlight lang="text" class="" style="" inline="1">*.conf</syntaxhighlight> to staff Template:Endash 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).

<syntaxhighlight lang="console" highlight="4"> $ 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 </syntaxhighlight>

See also

References

Template:Reflist

Template:Sister project

Template:Unix commands Template:Plan 9 commands Template:Core Utilities commands

de:Unix-Kommandos#Benutzer- und Rechteverwaltung

  1. ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}
  2. ↑ Template:Man