One linux Command (29) every day: chgrp command

Source: Internet
Author: User
Tags touch command


One linux Command every day (29): chgrp command link: One linux Command every day (1): ls command http://www.bkjia.com/ OS /210210/163049.html#linuxlinuxcommand every day (2): cd command serial (3 ): pwd command Export (4): mkdir command http://www.bkjia.com/ OS /201210/1620.3.html#a linuxcommand every day (5): rm command Export (6): rmdir command http://www.bkjia.com/ OS /201210/16401 7. html; one linux Command every day (7): mv command running (8): cp command http://www.bkjia.com/ OS /201210/163164.html#a linuxcommand every day (9): touch command running (10): cat command running (11 ): nl command http://www.bkjia.com/ OS /201211/165990.htmla linuxcommand every day (12): more command http://www.bkjia.com/ OS /201211/165994.htmllinuxcommand every day (13 ): Less command running (14): head command running (15): tail command running (16): which command http://www.bkjia.com/ OS /201211/168890.htmla linuxcommand (17) every day: whereis command running (18 ): locate command http://www.bkjia.com/ OS /201211/168895.htmla linuxcommand every day (19): find command Overview Explain (20): exechttp of the find command: // www.bkjia.com/ OS /201211/168901.htmllinuxcommand (21) every day: xargshttp of the find command: // explain (22): Explain the parameters of the find command (23 ): linux directory structure: http://www.bkjia.com/ OS /201211/170430.htmla linuxcommand every day (24): Linux file type and extension: http://www.bkjia.com/ OS /201211/170431.html A linuxcommand every day ((25): linux File Attribute details ↓ (26): Using SecureCRT to upload and download files http://www.bkjia.com/ OS /201211/172022.htmla linuxlinuxcommand every day (27): linux chmod command ↓ (28, control of file or directory permissions is managed by the owner and the groups in question. You can use the chgrp command to retrieve the group of the change file and directory. In this way, you can use the group name or group ID. The Chgrp command is short for the change group! The group name to be changed must exist in the/etc/group file. 1. Command Format: www.2cto.com chgrp [Option] [group] [file] 2. Command function: The chgrp command can change the group to which the file or directory belongs by using the group name or group ID. The permission is a Super User. 3. command Parameters: required parameters: -c output debugging information when a change occurs-f No error information is displayed-R displays detailed processing information when processing the specified directory and all files in its subdirectories-v runtime-dereference acts on the symbol link pointing, instead of the symbolic link itself -- no-dereference acts on the symbolic link itself and selects the parameter: -- reference = <file or directory> -- help display help information -- version display version information 4. run the command chgrp-v bin log2012.log to change the group attribute of a file by using instance: instance 1: [root @ localhost test] # ll --- xrw-r -- 1 root 302108 11-13 03 log2012.log [root @ localhost test] # chgrp-v bin log2012.log "log2012.log" group changed to bin [root @ localhost test] # ll --- xrw-r -- 1 root bin 302108 11-13 log2012.log description: change the log2012.log file from the root group to the bin group instance 2: Change the group attribute command of the file according to the specified file: www.2cto.com chgrp -- reference = log2012.log log2013.log output: [root @ localhost test] # ll --- xrw-r -- 1 root bin 302108 11-13 log2012.log-rw-r -- 1 root 61 11-13 log2013.log [root @ localhost test] # chgrp -- reference = log2012.log log2013.log [root @ localhost test] # ll --- xrw-r -- 1 root bin 302108 11-13 03 log2012.log-rw-r -- 1 root bin 61 11-13 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: Change the group attribute of the specified directory and all files in its subdirectories. command: output: [root @ localhost test] # lldrwxr-xr-x 2 root 4096 11-30 08:39 test6 [root @ localhost test] # cd test6 [root @ localhost test6] # ll --- xr -- r -- 1 root 302108 11-30 08:39 linklog. log --- xr -- r -- 1 root 302108 11-30 08:39 log2012.log-rw-r -- 1 root 61 11-30 08:39 log2013.log-rw-r -- 1 root root 0 11-30 08:39 log2014.log-rw-r -- 1 root 0 11-30 08:39 log2015.log-rw-r -- 1 root 0 11-30 08:39 log2016.log- rw-r -- 1 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 linklog. log --- xr -- r -- 1 root bin 302108 11-30 log2012.log-rw-r -- 1 root bin 61 11-30 08:39 log2013.log-rw-r -- 1 root bin 0 11-30 08:39 log2014.log-rw-r -- 1 root bin 0 11-30 08:39 log2015.log-rw-r -- 1 root bin 0 11-30 08:39 log2016.log- rw-r -- 1 root bin 0 11-30 08:39 log2017.log [root @ localhost test6] # cd .. [root @ localhost test] # lldrwxr-xr-x 2 root bin 4096 11-30 test6 [root @ localhost test] # description: change the group attributes of all files in the specified directory and Its subdirectories. Example 4: Use the group ID to change the group attributes. Command: chgrp-R 100 test6 output: [root @ localhost test] # chgrp-R 100 test6 [root @ localhost test] # lldrwxr-xr-x 2 root users 4096 11-30 test6 [root @ localhost test] # cd test6 [root @ localhost test6] # ll --- xr -- r -- 1 root users 302108 11-30 linklog. log --- xr -- r -- 1 root users 302108 11-30 log2012.log-rw-r -- 1 root users 61 11-30 08:39 log2013.log-rw-r -- 1 root users 0 11-30 08:39 log2014.log-rw-r -- 1 root users 0 11-30 08:39 log2015.log-rw-r -- 1 root users 0 11-30 08:39 log2016.log- rw-r -- 1 root users 0 11-30 08:39 log2017.log [root @ localhost test6] # description: change the attributes of the file group by using the group ID. 100 is the identifier of the users group. You can view the group and group ID in the/etc/group file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.