What is this order for?
In a nutshell, change the group of files and directories with CHGRP. CHGRP is the abbreviation for Change group. The changed group name must be in the/etc/group file, which means that the group name must already exist.
1. Command format:
chgrp [parameters] [group] [file]
2. Permission to use:
The usage permission is superuser.
3. Command parameters:
Common parameters:
-R handles all files in the specified directory and its subdirectories
-V Show Change results
--reference=< file or directory >**
4. Usage examples:
Example 1: Changing the group properties of a file
Command:
chgrp -v chuji001 niu2.py
Description
Change the niu2.py file from the root group to the CHUJI001 group, where the-V is used, and you can see whether the result is successful or not.
Example 2: Changing the group properties of a file according to a specified file
Command:
chgrp --reference=niu2.py niu3.txt
Description
Change the group properties of the file Niu3.txt, so that its group properties and file niu2.py Group properties are the same, here --reference=[file or folder] This command, usually work can be used.
Example 3: Changing the group properties of the specified directory and all files under its subdirectories
Command:
chgrp -R chuji001 fuck1
Description
Changes the group properties of all files in the specified directory and its subdirectories, where-R is used, recursively processing all files and subdirectories.
3 parameters, 3 instances, master these 3 parameters, chgrp This command is almost there, and some of the other parameters are rarely used in the work.
An unfamiliar Linux command every day (1)