vi/vim command summary
The following tables contain all the basic vi commands.
Starting vi
Command
Description
vi file
start at line 1 of file
vi +n file
start at line n of file
vi + file
start at last line of file
vi +/pattern file
start at pattern in file
vi -r file
recover file after a system crash
Saving files and quitting vi
Command
Description
:e file
edit file (save current file with :w first)
:w
save (write out) the file being edited
:w file
save as file
:w! file
save as an existing file
:q
quit vi
:wq
save the file and [...]
