Linux change file owner and owning Group Chown command note

Source: Internet
Author: User

Chown to change the main or owning group of a file

Change file owner: #chown Zek 123.txt (Zek is the name of the owner)

#ls-L 123.txt

-rw-rw-rw-1 Zek Root 12777 December 4 20:31 123.txt

Change file to group such as: #chown: User1 123.txt

# ls-l 123.txt

-rw-rw-rw-1 Zek user1 12777 December 4 20:31 123.txt

Change them together: #chown zek:user1 123.txt or

#chown Zek.user1 123.txt

# ls-l 123.txt

-rw-rw-rw-1 root root 12777 December 4 20:31 123.txt


-R Cascade Change: Change the current directory and all files in the current directory

Example: Chown-r zek.user1 111


Note: The command history shortcut keys are used:

#history View command History

#!ls from the command history from the bottom up to the nearest command that starts with LS and executes

such as #!ls

Ls-l 123.txt

-rw-rw-rw-1 root root 12777 December 4 20:31 123.txt

#!642 the command from the command history with ID bit 642 and executes it.

642 Ls-l 123.txt

643 Chown Root.root 123.txt

#!642

Ls-l 123.txt

-rw-rw-rw-1 root root 12777 December 4 20:31 123.txt


Create owning group: #groupadd groupname

Create User: #useradd Zek



Linux change file owner and owning Group Chown command note

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.