Original Blog Address: https://www.cnblogs.com/BaiYiShaoNian/p/4831022.html
Shell Common Commands Summary:
1. ls command: List files
Ls-a list all files and folders in the current directory
LS A * lists all files starting with the A letter in the current directory
Ls-l *.txt lists all files with the suffix txt in the current directory
2. CP Command: Copy
CP a.txt B.txt Copy the contents of file A to file B
CP a.txt./test Copy file A to the test directory
CP-A Test Test2 recursively copies all files (including hidden files) under directory test to the new directory Test2
3. Cat command: View combined files
Cat A.txt Viewing file contents
Cat A.txt >> B.txt combines the contents of a file to the end of the B file content
Cat-n a.txt Viewing the file and marking the file with the uplink number
4. Touch command: Create a file
Touch A.txt Create a txt-type file named a
5. RM command: Delete files
RM-RF a.txt forcibly deleting files a.txt
Rm-i a.txt You are prompted to delete the file before deleting it
RM * Delete all items under the folder
6. mkdir: Create directory
mkdir test to create a directory named Test
RmDir Test Deletes a directory
7. Echo, Cat command: Add content
echo "Hello world!" >> a.txt Add content to file a
Cat <<EOF>> A.txt can add multiple lines of statements to the end of the contents of the file itself
Cat <<EOF> a.txt Add content to a file and overwrite the original content
8. MV Command: Move rename file
MV A.txt b.txt file a renamed to B
MV A.txt./test move files to a directory
9. CD Command: Change directory
CD ~ Switch to the top-level directory, that is, the user directory
Cd.. Return to previous level directory
Cd.. /.. Go back to the top two level directory
10. grep command: Search for files
Ls-la | grep a.txt Search for a.txt files (pipe break is the standard output of one command as a normal input to another command)
Find filename finds whether the file or directory is in the current directory
11, head, Tail command: Display the contents of the file
Head displays the first 10 lines of the file
Tail display the following 10 lines of the file
TAIL-F filename Monitor the tail content of the file, refresh the display on the screen
Tail-n filename Displays the contents of the last 20 lines of filename
Tail-r-n filename Displays the contents of the last 10 lines of the file in reverse order
Vim Common Command Daquan
ESC: Exit Edit mode
CTRL-T: Move to next tab
Backspace: Move backward one character
Ctrl-u: Delete the current
CW: Delete the character of the cursor and enter edit mode
CC: Delete the row where the cursor is located and enter edit mode
C: Remove the character from the cursor's location to the end of the line and enter edit mode
DD: Delete When moving forward
NDD: Delete the nth row
D: Delete the character following the position of the current row cursor
DW: Delete the character that the zip code resides in
D}: Delete the remaining characters from the current segment
d^: Delete the character before the cursor to the beginning
U: Undo the last change
. : Restores the last change
~: Reverse the case of letters
Shell common commands and vim editing commands