vi Cheat Sheet Basic Commands PDF Print E-mail

Basic vi Commands in Cheat Sheet for Easy Reference

 

This command list is incomplete at the moment.  I'm still working out the most common and/or useful commands.

Most of the commands here will work anywhere that vi is loaded, but in my experience different flavors of UNIX have slightly different commands or keystrokes.  In particular, Solaris has had me using 'edit' or piping 'echo' strings into text files for easier additions.

I know that the following list works on Linux all over the place, at least these commands have worked on every Linux system I have worked on.

 

 

[COMMAND MODE]

dd [Delete the current line and newline then send to standard buffer]
dw [Delete the current word and send to standard buffer]

D [Delete from cursor to end of line - do not remove newline character]

d) [Delete from cursor to the end of sentence (not the end of line)]
u [Undo the last change]

U [Undo all the changes on selected line]
. [Repeat the last command]

cw [Change Word at cursor - press escape after typing new word]
cc [Change line - press escape after typing the new sentence]
r [Replace character - the key press following 'r' is the new character]

 

[INSERT OR INPUT MODE]

a [Enter input mode a character after the cursor]

i [Enter input mode a character before the cursor]

o [Enter input mode after creating a new line below the cursor]

O [Enter input mode after creating a new line above the cursor]


[MOVEMENT]

H [Home - upper left corner]
M [Middle line]
L [Lower left corner]
l [Back a character]
h [Back a character]

k [Up a line]
^ [Beginning of line]
$ [End of line]
j [down a line]

w [Forward one word]
b [Back one word]

 
Joomla SEF URLs by Artio
 
JOOMLA TEMPLATES Joomla Templates By JoomlaBear