Chgrp
Encyclopedia
The chgrp command
Command (computing)
In computing, a command is a directive to a computer program acting as an interpreter of some kind, in order to perform a specific task. Most commonly a command is a directive to some kind of command line interface, such as a shell....

 is used by unprivileged
Privilege (Computing)
In computing, privilege is defined as the delegation of authority over a computer system. A privilege is a permission to perform an action. Examples of various privileges include the ability to create a file in a directory, or to read or delete a file, access a device, or have read or write...

 users on Unix-like
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....

 systems to change the group associated with a computer file
Computer file
A computer file is a block of arbitrary information, or resource for storing information, which is available to a computer program and is usually based on some kind of durable storage. A file is durable in the sense that it remains available for programs to use after the current program has finished...

. Unlike the chown
Chown
The chown command is used on Unix-like systems to change the owner of a file. In most implementations, it can only be executed by the superuser. Unprivileged users who wish to change the group of a file that they own may use chgrp.-Usage examples:These examples illustrate typical syntax and use...

 command, chgrp allows regular users to change groups, but only to one of which they are a member.

Usage

The general syntax of the chgrp command is:


chgrp group target1 [target2 ..]

  • The group parameter indicates the new group with which the targets should be associated. It may either be a symbolic name or an identifier
    Group identifier (Unix)
    In Unix-like systems, multiple users can be categorized into groups. POSIX and conventional Unix file system permissions are organized into three classes, user, group, and others. The use of groups allows additional abilities to be delegated in an organized fashion, such as access to disks,...

    .
  • The target1 parameter indicates the files or directories for which the change should be made.
  • The target2 parameter indicates optional additional files or directories for which the change should be made.

Usage example


$ ls -l ttt
-rw-r--r-- 1 gbeeker staff 545 Nov 04 2004 ttt
$ chgrp system ttt
$ ls -l ttt
-rw-r--r-- 1 gbeeker system 545 Nov 04 2004 ttt


The above command changes the group associated with directory ttt to 'system', provided the executing user is a member of that group.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK