What is a shell?
The shell has some common command set, which is an instruction for invoking the inner core of the system.
Here's a list of some common shell commands
ls: View all files in the directory
-L : View file Details
-A: View all files, including hidden files
PWD: View the directory where your current work is located
CD: Go to a directory
CD ~ : Returns the user's home directory
Cd.. : Returns to the previous layer
CD Absolute Path
CD relative path
Clear: Clear Screen
Logout: Log Off users
Shutdown: Off
-H : Shutdown
-R: restart
-K: Warning
-C: Cancel
Halt: Shut down the machine
Reboot: Restart
VI Shortcut keys
1) move cursor
H : Move the cursor one character to the left
J : Move the cursor up one character
K : The cursor moves down one character
L : Move the cursor right one character
0 : Cursor moves to the beginning of the line
$ : Cursor moves to end of line
H : Move the cursor to the top line of the screen
M : Move the cursor to the middle of the screen
L : The cursor moves to the bottom line of the screen
2) Insert text
I : Insert content in front of cursor
A : Insert content after cursor
o : Insert a new row on the next line of the row
O : Insert a new row on the previous line of the row
3) Delete text
X: Delete the character following the cursor
X: Delete the characters in front of the cursor
NX: Delete n characters after cursor
NX: Delete n characters before the cursor
D0: Delete the cursor to the beginning of the text
d$: Delete the cursor to the end of the line
DD : Delete entire row
NDD : Delete n rows down
4) Copy text
YY : Copy entire row
Nyy : Copy n rows
P : Paste the next line in the same row
P : Paste a line on the same row
DD : Cut
5) Find text
/pattern : Looking down
? pattern : Find up
N : Sequential lookup
N : Reverse Lookup
: s/p1/p2/g : In the current line, replace p1 with p2
: n1,n2s/p1/p2/g : replace p1 between N1 and n2 rows with p2
6) screen tumbling
Ctrl+u: First half screen to file
Ctrl+d: Half-screen to the end of the file
Ctrl+f: Flip a screen to the end of a file
Ctrl+b: Turn one screen at the top of the file
7) last line command
: N1,N2 CO n3 : Copy the N1 to n2 line below the N3 line
: n1,n2 m n3 : cut N1 to n2 line below N3 row
: N1,n2 d : delete N1 to n2 Row
: w Save
: Q Exit
: x Save and exit
: q! Force Exit
: w! Force Save
: numbers are positioned to the specified line
: Set nu Displays line number
: Set Nonu cancel line number
U: Cancel last action
Common shell commands