The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

chgrp - change the file group ownership

 SYNOPSIS



chgrp [-R] group file ...

 DESCRIPTION

The chgrp utility will set the group ID of the file named by each file operand to the group ID specified by the group operand.

For each file operand, it will perform actions equivalent to the XSH specification chown() function, called with the following arguments:

Unless chgrp is invoked by a process with appropriate privileges, the set-user-ID and set-group-ID bits of a regular file will be cleared upon successful completion; the set-user-ID and set-group-ID bits of other file types may be cleared.

 OPTIONS

The chgrp utility supports the XBD specification, Utility Syntax Guidelines  .

The following option is supported:

-R
Recursively change file group IDs. For each file operand that names a directory, chgrp will change the group of the directory and all files in the file hierarchy below it.

 OPERANDS

The following operands are supported:
group
A group name from the group database or a numeric group ID. Either specifies a group ID to be given to each file named by one of the file operands. If a numeric group operand exists in the group database as a group name, the group ID number associated with that group name is used as the group ID.
file
A pathname of a file whose group ID is to be modified.

 STDIN

Not used.

 INPUT FILES

None.

 ENVIRONMENT VARIABLES

The following environment variables affect the execution of chgrp:
LANG
Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined.
LC_ALL
If set to a non-empty string value, override the values of all the other internationalisation variables.
LC_CTYPE
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).
LC_MESSAGES
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
NLSPATH
Determine the location of message catalogues for the processing of LC_MESSAGES .

 ASYNCHRONOUS EVENTS

Default.

 STDOUT

Not used.

 STDERR

Used only for diagnostic messages.

 OUTPUT FILES

None.

 EXTENDED DESCRIPTION

None.

 EXIT STATUS

The following exit values are returned:
0
The utility executed successfully and all requested changes were made.
>0
An error occurred.

 CONSEQUENCES OF ERRORS

If, when invoked with the -R option, chgrp attempts but fails to change the group ID of a particular file in a specified file hierarchy, it will continue to process the remaining files in the hierarchy. If chgrp cannot read or search a directory within a hierarchy, it will continue to process the other parts of the hierarchy that are accessible.

 APPLICATION USAGE

Only the owner of a file or the user with appropriate privileges may change the owner or group of a file.

Some systems restrict the use of chgrp to a user with appropriate privileges when the group specified is not the effective group ID or one of the supplementary group IDs of the calling process.

 EXAMPLES

None.

 FUTURE DIRECTIONS

None.

 SEE ALSO

chmod, chown, the XSH specification description of chown().

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]