There are so many commands we use while working with vi editors. Here I have shared some commands.

i    – for insert mode.
I    – inserts text at the curson
A   – appends text at the end of the line.
a    – appends text after cursor.
O   – open a new line of text above the curson.
o    – open a new line of text below the curson.
:     – for command mode.
<escape> – to invoke command mode from insert mode.
:!sh  – to run unix commands.
x       – to delete a single character.
dd    – to delete an entire line
ndd – to delete n number of lines.
d$   – to delete from cursor to end of line.
yy   – to copy a line to buffer.
P    – to paste text from buffer.
nyy – copy n number of lines to buffer.
:%s/stringA/stringb /g – to replace stringA with stringB in whole file.
G    – to go to last line in file.
1G   – to go to the first line in file.
w     – to move forward to next word.
b     – to move backwards to next word.
$     – to move to the end of line.
J     – join a line with the one below it.
/     – string to search string in file.
n     – to search for next occurrence of string.

Recent Posts

Start typing and press Enter to search