In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
The editor today takes you to understand what is the command of the group in which the Linux system modifies the files. The knowledge points in the article are introduced in great detail. Friends who feel helpful can browse the content of the article together with the editor, hoping to help more friends who want to solve this problem to find the answer to the problem. Let's follow the editor to learn in depth the knowledge of "what is the command of the group in which the Linux system modifies the file?"
1. Command format: chgrp [option] [group] [file]
2. Command function: the chgrp command can use the group name or group identification code to change the group to which the file or directory belongs. The permission is superuser.
3. Command parameters: required parameters:
-c output debugging information when a change occurs
-f does not display error messages
-R processes all files in the specified directory and its subdirectories
-v the runtime displays detailed processing information
-dereference acts on the direction of the symbolic link, not on the symbolic link itself
-no-dereference acts on the symbolic link itself
Select parameters:
-reference= "file or directory"
-help displays help information
-version displays version information
4. Use example: example 1: change the group attributes of the file command:
The code is as follows:
Chgrp-v bin log2012.log
Output:
The code is as follows:
[root@localhost test] # ll
-xrw-r- 1 root root 302108 11-13 06:03 log2012.log
[root@localhost test] # chgrp-v bin log2012.log
The group of "log2012.log" has been changed to bin
[root@localhost test] # ll
-xrw-r- 1 root bin 302108 11-13 06:03 log2012.log
Description:
Change the log2012.log file from root group to bin group
Example 2: command to change the group attributes of a file according to the specified file:
The code is as follows:
Chgrp-reference=log2012.log log2013.log
Output:
The code is as follows:
[root@localhost test] # ll
-xrw-r- 1 root bin 302108 11-13 06:03 log2012.log
-rw-r-r- 1 root root 61 11-13 06:03 log2013.log
[root@localhost test] # chgrp-reference=log2012.log log2013.log
[root@localhost test] # ll
-xrw-r- 1 root bin 302108 11-13 06:03 log2012.log
-rw-r-r- 1 root bin 61 11-13 06:03 log2013.log
Description:
Change the group attribute of the file log2013.log so that the group attribute of the file log2013.log is the same as that of the reference file log2012.log
Example 3: command to change the group properties of all files under the specified directory and its subdirectories:
The code is as follows:
Chgrp-R bin test6
Output:
The code is as follows:
[root@localhost test] # ll
Drwxr-xr-x 2 root root 4096 11-30 08:39 test6
[root@localhost test] # cd test6
[root@localhost test6] # ll
-xr-r- 1 root root 302108 11-30 08:39 linklog.log
-xr-r- 1 root root 302108 11-30 08:39 log2012.log
-rw-r-r- 1 root root 61 11-30 08:39 log2013.log
-rw-r-r- 1 root root 0 11-30 08:39 log2014.log
-rw-r-r- 1 root root 0 11-30 08:39 log2015.log
-rw-r-r- 1 root root 0 11-30 08:39 log2016.log
-rw-r-r- 1 root root 0 11-30 08:39 log2017.log
[root@localhost test6] # cd . .
[root@localhost test] # chgrp-R bin test6
[root@localhost test] # cd test6
[root@localhost test6] # ll
-xr-r- 1 root bin 302108 11-30 08:39 linklog.log
-xr-r- 1 root bin 302108 11-30 08:39 log2012.log
-rw-r-r- 1 root bin 61 11-30 08:39 log2013.log
-rw-r-r- 1 root bin 0 11-30 08:39 log2014.log
-rw-r-r- 1 root bin 0 11-30 08:39 log2015.log
-rw-r-r- 1 root bin 0 11-30 08:39 log2016.log
-rw-r-r- 1 root bin 0 11-30 08:39 log2017.log
[root@localhost test6] # cd . .
[root@localhost test] # ll
Drwxr-xr-x 2 root bin 4096 11-30 08:39 test6
[root@localhost test] # "/ p"p"
Description:
Change the group properties of all files under the specified directory and its subdirectories
Example 4: command to change file group attributes through group identification code:
The code is as follows:
Chgrp-R 100 test6
Output:
The code is as follows:
[root@localhost test] # chgrp-R 100 test6
[root@localhost test] # ll
Drwxr-xr-x 2 root users 4096 11-30 08:39 test6
[root@localhost test] # cd test6
[root@localhost test6] # ll
-xr-r- 1 root users 302108 11-30 08:39 linklog.log
-xr-r- 1 root users 302108 11-30 08:39 log2012.log
-rw-r-r- 1 root users 61 11-30 08:39 log2013.log
-rw-r-r- 1 root users 0 11-30 08:39 log2014.log
-rw-r-r- 1 root users 0 11-30 08:39 log2015.log
-rw-r-r- 1 root users 0 11-30 08:39 log2016.log
-rw-r-r- 1 root users 0 11-30 08:39 log2017.log
[root@localhost test6] #
Description:
Change the file group attribute through the group identification code. 100 is the identification code of the users group. The specific group and group identification code can be checked in the / etc/group file.
Thank you for your reading, the above is the whole content of "what is the order of the Linux system to modify the file group?" learn friends to hurry up to operate it. I believe that the editor will certainly bring you better quality articles. Thank you for your support to the website!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.