1. VI Command
1. Move the cursor to the last line of the file G: $]]
2. Move the cursor to the first line of the file: 0 GG [[
3. Move the cursor from the cursor position to the beginning of the current line 0 ^ home
4. Move the cursor to the end of the current line from the cursor location $ end
5. Cancel the last action U
6. Delete row dd; Delete n rows ndd
7. Search down/character, continue search N, reverse search n
8. Search up? character, continue search N, reverse search n
2, Chattr;lsattr
chattr, changing the file's extended properties
A: You can append data to a file only
[Email protected]~]# chattr +a test.txt
[Email protected]~]# lsattr test.txt
[Email protected]~]# rm-f test.txt
RM: Unable to delete "test.txt": Operation not allowed
[[Email protected]~]# >test.txt
-bash:test.txt: Operations not allowed
[[Email protected]~]# echo 111 >> test.txt
I: File lock
[[Email protected]~]# echo 111 >> test.txt
-bash:test.txt: Insufficient Authority
Lsattr, displaying extended properties of a file
[Email protected]~]# lsattr test.txt
3, Chown
Chown, changing the owner and owner of a file
Chown User files or directories
Chown: User group file or directory
Chown user. User group file or directory
-r: Recursively change directory and subdirectory properties
4, chmod
chmod, changing file directory permissions
chmod [option] mode file
-R recursion
Mode +-=
R 4 Read
W 2 Write
X 1 execution
-0 No
[Email protected]~]# chmod u=x,g=w,o=rwx test.txt
[Email protected]~]# ll-h text.txt
[Email protected]~]# chmod o=---test.txt or chmod o-rwx test.txt
[Email protected]~]# chmod 755 test.txt
5. Cat
Cat, view file contents
-N: Mark line number
-B: Line numbers are only marked for non-empty rows
-E: The end of the line displays the $ symbol, and the empty line also has
-S: Compress empty rows
6. Tac
TAC, Reverse view
7, more
More, view files, have page view function
B button: Turn up one screen
SPACEBAR: Scroll down one screen
Enter: Display 1 rows down
= Number: Displays the current line number
/Find File: Find the specified text
8. Less
Less, paging through files, more powerful than more
9. Head
Head, showing the first part of the file, the head of the file
10, tail
Tail, view the end of the file
11. Cut
Cut, cut
-B, cut in bytes (Chinese environment where a character equals two bytes)
-C, cut by character (one character equals one byte in English environment)
-D, specifying delimiters
[Email protected]~]# head-l/etc/passwd
Root:x:0:0:root:/root:/bin/bash
[[Email protected]~]# head-l/etc/passwd | Cut-d:-f4
0
-T, which displays the tab delimiter
Sed-n L (letter L) Test.txt: print invisible characters
The cut defaults to the TAB key as the delimiter, and awk defaults to the SPACEBAR as the delimiter
Linux command explanation