Linux common Commands--file operations, permissions settings

Source: Internet
Author: User

1. Edit the file

VI aaa.txt    open aaa.txt file    Esc key         switch Edit and command mode    command mode input: (colon), you can enter the command    : S/  string 1/ String 2  Replace string 1 with string 2    : Wq! Save the file and exit    : Q!  Force exit file Editing    

2. View the contents of the file

cat aaa.txt       View        contents of aaa.txt file -5  aaa.txt   View the contents        of the first 5 rows of the Aaa.txt file -  aaa.txt  Show the contents of the last 10 lines of the Aaa.txt file   

3. Operation User and user group

su root      switch to root user    WhoAmI       View current logged-in user groups view current user's       group ID to see           uid and GID    Useradd      Add a new user (root)    passwd sa    set the SA user's password (under root)    passwd       Change Password    userdel      Delete User (root)     Groupadd G1       add G1 Group (root)    -G G1 SA  assigns SA user to G1 Group (root)

4. Set file permissions

751 temp    Sets 751 permissions to the Temp folder -rwxr-x--x    111101001     751
All represent a permission,
-rwxr-x--X,111 101 001,751  cannot type permission representation, permission level is the same, above 751 for the other 2 look also ok
PS is used to display the status of the current process

Permission Explanation:

-r-xr-xr--
101 101 1002 Binary
554
-RW--W---X
110 010 001
621
-rwxrwxr--
111 111 100
774
-R---W---x
100 010 001
421

Summary rule: R indicates that 4,w means that 2,x represents 1


Linux common Commands--file operations, permissions settings

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.