Note à I’m dividing the command in a multiple tables for a better visibility and understanding.
KEY |
PURPOSE |
i |
To
start the file in Insert Mode |
esc + I
( In Capital Letter) |
To
insert the data at the beginning of the line |
esc + a |
Appends
to the right of the current character |
esc +
A |
Appends
at the end of the current line |
esc + o |
Insert
new line after the current line |
esc + O
( In Capital Letter) |
Insert
the new line before the current line |
esc + GG
( 2 Times) |
Go to
the top of the file |
esc + Shift
+ G |
Go
into the bottom of the file |
KEY |
PURPOSE |
l |
Move one character right |
Ctrl +
D |
Move
down one-half page from current line |
Ctrl +
U |
Move
up one-half page from current line |
Ctrl +
F |
Move
forward one page |
Ctrl +
B |
Move
back one page |
G |
Jump |
Number
+ j |
Move
the cursor down to the current line |
h |
Move
one character left |
j |
Move
one line down |
k |
Move
one line up |
Number
+ G |
This
command is very helpful when we get an error in a shell script with a line
number and we want to go directly into the reported line number |
KEY |
PURPOSE |
yy |
Copy
current line |
number
+ yy |
Copy
mentioned number of line from current line |
p |
Paste
the copied line |
u |
Undo
the last command |
r |
Redo
the last command |
. (
dot) |
Repeat
the last command |
esc +
? + text |
Search
the text from bottom |
esc +
/ + text |
Search
the text from top |
esc +
/ + text + n |
Repeat
the last search |
esc + ?
+ text + N |
Repeat
the last search in reverse order |
esc +
%s/text_to_replace/new_text/gc |
Change
the text globally in a file |
KEY |
PURPOSE |
esc + ZZ |
Save
the current file & quit vi |
esc + :w |
Save
current file |
esc + :q! |
Really
quit vi |
esc + :n |
Jump to
the line number |
:f |
Report
the name of the currentfile and line no. |