|
chgrp
Change group ownership (update the group ID of files.)
SYNTAX chgrp [-fhv] [-R [-H | -L | -P]] group file ... The group operand can be either a group name, or a numeric group ID. KEY -R Recurse: Change the mode of file hierarchies rooted in the files instead of just the files themselves. -R -H Follow symbolic links on the command line (by default Symbolic links within the tree are not followed.) -R -L All symbolic links are followed. -R -P No symbolic links are followed. (default) -f Force, ignores errors, except for usage errors and doesn't query about strange modes (unless the user lacks permissions). -h If the file is a symbolic link, the group ID of the link itself is changed rather than the file that is pointed to. -v Verbose, show filenames as the group is modified.
The user invoking chgrp must belong to the specified
group and be the owner of the file, or be the super-user.
Notes
The chgrp utility exits 0 on success, and >0 if an error occurs.
The -v option is non-standard and its use in scripts is not recommended.
Examples
Assign Ursula as the owner of "MyFile.txt" file in the Shared directory.
sudo chown Ursula /Users/Shared/MyFile.txt
Assign Ursula as the owner, and staff as the group for everything in the "tmp" folder
sudo chown -R Ursula:staff /Users/Shared/tmp/
"If an organization carries the word "united" in its name, it means
it isn't, e. g., United Nations, United Arab Republic, United Kingdom, United
States" - Professor
Charles I. Issawi
Related commands:
chflags - Change a file or folder's flags.
chmod - Change access permissions
chown - Change file owner and group
install - Copy files and set attributes
ln - Make links between files (hard links, symbolic links)
mount - Mount a file system
passwd - Modify a user password
umask - Users file creation mask
Equivalent BASH command:
chgrp - Change file owner and/or group.