One linux Command every day (30): chown command

Source: Internet
Author: User
Tags touch command

One linux Command every day (30): chown 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 explanation example (26): Use SecureCRT to upload and download files. Example (27): linux chmod command example (28): tar command http://www.bkjia.com/ OS /201212/172.161.html A linuxcommand every day (29 ): the chgrp command http://www.bkjia.com/ OS /201212/172983.html chown changes the owner of the specified file to the specified user or group, which can be the user name or user ID; the group can be the group name or group ID; files are separated by spaces. List of parts. 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 = <directory or File>, the specified directory/file is used as a reference, set the operation file/directory to the reference file/directory with the same owner and group -- from = <Current User: current group> changes are made only when the current user and group are the same as the specified user and group -- help displays help information -- version displays 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

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.