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