In a Linux system, control over the permissions of a file or directory is managed by the owner and the group to which it belongs. You can use the CHGRP command to change the file and directory to belong to the group, this way with the group name or group identification code can be.
The CHGRP command is the abbreviation for Change group. The group name to be changed must exist within the/etc/group file.
1. Command format:
CHGRP [Options] [group] [file]
2. Command function:
The CHGRP command can change the group that the file or directory belongs to by using a group name or a group identifier. The usage permission is superuser.
3. Command parameters:
Necessary parameters:
-C Output Debug information when a change occurs
-F does not display error messages
-R handles all files in the specified directory and its subdirectories
-V Run-time display verbose processing information
--dereference acts on the point of a symbolic link, not the symbolic link itself
--no-dereference effect on the symbolic link itself
Select parameters:
--reference=< files or Directories >
--help
--version These two commands do not really want to fight every time. ............
4. Usage examples:
Example 1: Changing the group properties of a file
Command: Chgrp-v bin 001.log Change 001.log file from root group to bin Group
Example 2: Changing the group properties of a file according to a specified file
Command: chgrp--reference=001.log 002.log Change the file 002.log group properties, make the file 002.log properties and Reference files 001.log Group properties of the same
Example 3: Changing the group properties of the specified directory and all files under its subdirectories
Command: Chgrp-r bin test involves directories and subdirectories is the R parameter
Example 4: Changing file group properties by group ID
Command: Chgrp-r test
Group identification code to change the file group properties, 100 for the Users group identification code, specific groups and group identification code can go to/etc/group file to view
One Linux command per day (--CHGRP) command