chgrp
Quick Reference
Command Name:
chgrp
Category:
file ownership
Platform:
linux
Basic Usage:
Common Use Cases
Syntax
chgrp [OPTION]... GROUP FILE... chgrp [OPTION]... --reference=RFILE FILE...
Options
Option | Description |
---|---|
-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 |
--dereference | Affect the referent of each symbolic link (default), rather than the symbolic link itself |
-h, --no-dereference | Affect symbolic links instead of any referenced file |
--no-preserve-root | Do not treat '/' specially (the default) |
--preserve-root | Fail to operate recursively on '/' |
--reference=RFILE | Use RFILE's group rather than specifying a GROUP value |
-R, --recursive | Operate on files and directories recursively |
--help | Display help and exit |
--version | Output version information and exit |
Examples
How to Use These Examples
The examples below show common ways to use the chgrp
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
# Change the group of a file to 'staff' chgrp staff filename.txt
Advanced Examples:
# Recursively change group for a directory and its contents chgrp -R developers /home/projects