One linux command every day (30): chown command

Source: Internet
Author: User
Tags touch command
One linux command every day (30): link to the chown command: One linux command every day (1): ls command http://www.2cto.com/os/201210/163049.html ; One linux command every day (2): cd command http://www.2cto.com/os/201210/163050.html A linux command every day (30): chown command link: A linux command every day (1): ls command http://www.2cto.com/os/201210/163049.html ; One linux command every day (2): cd command http://www.2cto.com/os/201210/163050.html ; One linux command every day (3): pwd command http://www.2cto.com/os/201210/163462.html ; One linux command every day (4): mkdir command http://www.2cto.com/os/201210/163463.html ; One linux command every day (5): rm command http://www.2cto.com/os/201210/163662.html ; One linux command (6) every day: rmdir command http://www.2cto.com/os/201210/164017.html ; One linux command (7) every day: mv command http://www.2cto.com/os/201210/164247.html ; One linux command every day (8): cp command http://www.2cto.com/os/201210/164254.html ; One linux command every day (9): touch Command http://www.2cto.com/os/201211/165699.html ; One linux command every day (10): cat command http://www.2cto.com/os/201211/165989.html ; One linux command every day (11): nl command http://www.2cto.com/os/201211/165990.html One linux command every day (12): more command http://www.2cto.com/os/201211/165994.html One linux command every day (13): less command http://www.2cto.com/os/201211/165998.html One linux command every day (14): head Command http://www.2cto.com/os/201211/166191.html One linux command every day (15): tail command http://www.2cto.com/os/201211/168702.html One linux command every day (16): which command http://www.2cto.com/os/201211/168890.html A linux command (17) every day: whereis command http://www.2cto.com/os/201211/168893.html One linux command (18) every day: locate command http://www.2cto.com/os/201211/168895.html One linux command every day (19): find command overview http://www.2cto.com/os/201211/168897.html One linux command every day (20): find command exec http://www.2cto.com/os/201211/168901.html One linux command (21) every day: find command xargs http://www.2cto.com/os/201211/168903.html A linux command (22) every day: detailed description of the parameters of the find Command http://www.2cto.com/os/201211/168912.html A linux command (23) every day: Linux directory structure http://www.2cto.com/os/201211/170430.html One linux command every day (24): Linux file type and extension http://www.2cto.com/os/201211/170431.html One linux command every day (25): Explanation of linux file attributes http://www.2cto.com/os/201211/170434.html One linux command every day (26): use SecureCRT to upload and download files http://www.2cto.com/os/201211/172022.html One linux command every day (27): linux chmod command http://www.2cto.com/os/201211/172028.html One linux command every day (28): tar command http://www.2cto.com/os/201212/172641.html One linux command (29) every day: chgrp command http://www.2cto.com/os/201212/172983.html Chown changes the owner of a specified file to a specified user or group. The user can be the user name or user ID, and the group can be the group name or group ID; files are separated by spaces to change the permission list. wildcards are supported. The system administrator often uses the chown command to grant the user the permission to use the file after copying the file to another user's directory. Www.2cto.com 1. command format: chown [option]... [owner] [: [group] file... 2. command function: use chown to change the owner and group of a file. When changing the file owner or group, you can use the user name and user ID settings. Normal users cannot change their files to other owners. The operation permission is generally administrator. 3. command parameters: Required parameters: -c: Display the changed information.-f: ignore the error information.-h: fix the symbolic link.-R: process the specified directory and all files in its subdirectories.-v: Display detailed processing information.-deference applies point of the symbolic link, instead of selecting the parameter for the link file itself: -- reference = <目录或文件> Use the specified directory/file as a reference, and set the operated file/directory to the same owner and Group of the reference file/directory -- from = <当前用户:当前群组> Only when the current user and group are the same as the specified user and group -- help display help information -- version display version information 4. use instance: instance 1: Change owner and group command: chown mail: mail log2012.log output: [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] # chown mail: mail log2012.log [root @ localhost test6] # ll --- xr -- r -- 1 root users 302108 11-30 linklog. log --- xr -- r -- 1 mail 302108 11-30 08:39 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: instance 2: change the file owner and group command: chown root: log2012.log output: [root @ localhost test6] # ll Total 604 --- xr -- r -- 1 root users 302108 11-30 linklog. log --- xr -- r -- 1 mail 302108 11-30 08:39 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] # chown root: log2012.log [root @ localhost test6] # ll Total 604 --- xr -- r -- 1 root users 302108 11-30 linklog. log --- xr -- r -- 1 root 302108 11-30 08:39 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: instance 3: Change file Group Command: chown: mail log2012.log output: [root @ localhost test6] # ll Total 604 --- xr -- r -- 1 root users 302108 11-30 linklog. log --- xr -- r -- 1 root 302108 11-30 08:39 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] # chown: mail log2012.log [root @ localhost test6] # ll Total 604 --- xr -- r -- 1 root users 302108 11-30 linklog. log --- xr -- r -- 1 root mail 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 log2017.log description: example 4: run the chown-R-v root: mail test6 command to change the owner and group of all files in the specified directory and its subdirectories. the output is as follows: [root @ localhost test] # lldrwxr-xr-x 2 root users 4096 11-30 test6 [root @ localhost test] # chown-R-v root: the owner of mail test6 "test6/log2014.log" has been changed to root: mail "test6/linklog. the owner of log has changed to root: mail "test6/log2015.log" and has changed to root: mail "test6/log2013.log: the owner of mail "test6/log2012.log" has been reserved as root: the owner of mail "test6/log2017.log" has been changed to root: the owner of mail "test6/log2016.log" has been changed to root: the owner of mail "test6" has been changed to root: mail [root @ localhost test] # lldrwxr-xr-x 2 root mail 4096 11-30 test6 [root @ localhost test] # cd test6 [root @ localhost test6] # ll total 604 --- xr -- r -- 1 root mail 302108 11-30 linklog. log --- xr -- r -- 1 root mail 302108 11-30 log2012.log-rw-r -- 1 root mail 61 11-30 08:39 log2013.log-rw-r -- 1 root mail 0 11-30 08:39 log2014.log-rw-r -- 1 root mail 0 11-30 08:39 log2015.log-rw-r -- 1 root mail 0 11-30 08:39 log2016.log- rw-r -- 1 root mail 0 11-30 08:39 log2017.log
Related Article

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.