0% found this document useful (0 votes)
19 views2 pages

CHGRP Command

The chgrp command changes the group ownership of files in Linux and Unix systems. It has the following syntax: chgrp [OPTION]... GROUP FILE.... The command allows specifying a group name or using --reference to set the group of files to match a reference file. It supports options like -R for recursive changes, -v for verbose output, and --dereference/-h to control how symlinks are handled. Examples demonstrate changing the group of a single file or recursively changing the group of a directory and subdirectories.

Uploaded by

Darko
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views2 pages

CHGRP Command

The chgrp command changes the group ownership of files in Linux and Unix systems. It has the following syntax: chgrp [OPTION]... GROUP FILE.... The command allows specifying a group name or using --reference to set the group of files to match a reference file. It supports options like -R for recursive changes, -v for verbose output, and --dereference/-h to control how symlinks are handled. Examples demonstrate changing the group of a single file or recursively changing the group of a directory and subdirectories.

Uploaded by

Darko
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Linux chgrp command

Updated: 04/26/2017 by Computer Hope

• About chgrp
• chgrp syntax
• chgrp examples
• Linux and Unix commands help

About chgrp
Changes group ownership of a file or files.

Description
Change the group of each FILE to GROUP. With --reference, change the group of each FILE to that
of RFILE.

chgrp syntax
chgrp [OPTION]... GROUP FILE...

chgrp [OPTION]... --reference=RFILE FILE...

Options
-c, --changes Like verbose but report only when a change is made.
-f, --silent, --quiet Suppress most error messages.

-v, --verbose Output a diagnostic for every file processed.

Affect the referenced file of each symbolic link, rather than the symbolic link
--dereference
itself, which is default setting.

-h, --no- Affect symbolic links instead of any referenced file. This option is useful only on
dereference systems that can change the ownership of a symlink.

--no-preserve-root Do not treat '/' in any special way. This option is the default.

--preserve-root Do not operate recursively on '/'.

--reference=RFILE Use RFILE's group rather than specifying a GROUP value.

-R, --recursive Operate on files and directories recursively.

The following options modify how a hierarchy is traversed when the -R option is also specified. If
more than one of these options is specified, only the final one takes effect:

-H If a command line argument is a symbolic link to a directory, traverse it.

-L Traverse every symbolic link to a directory.

-P Do not traverse any symbolic links. This option is the default.

--help Display a help message and exit.

--version Output version information and exit.

chgrp examples
chgrp hope file.txt

Change the owning group of the file file.txt to the group named hope.
chgrp -hR staff /office/files

Change the owning group of /office/files, and all subdirectories, to the group staff.

You might also like