INTRODUCTION TO UNIX
vi Command Summary
Using vi from UNIX:
vi file_name edit file_name
vi -r file_name recover file_name from crash
Note: Most of the following vi commands must be preceded by a
number for repetition.
Basic cursor motions:
h right
j down
k up
l left
CR down to first non-blank
0 beginning of line
$ end-of-line
Screen Control:
^U ^D up or down half a page
^B ^F up or down a whole page
^L reprint page
Note: all commands marked with a + enter input mode and are
exited with the escape (ESC) character.
Character input modes:
+a append after cursor
+A append at end-of-line
+i insert before cursor
+I insert before first non-blank
+o add lines after current line
+O add lines before current line
Delete and change:
dd delete line
+cc change line
D delete from cursor to EOL
+C change from cursor to EOL
x delete character
+s change character
+S change line
rchar replace current char with char
+R overprint change
Word commands:
w next word
b back word
e end of word
dw delete word
+cw change word
Search:
/string/ search for string
?string? reverse search for string
n repeat last / or ?
N reverse of n
Miscellaneous:
u undo previous command
U restroe entire line
yobject save object in temp buffer
Y save line(s) in temp buffer
p put saved buffer after cursor
P put saved buffer before cursor
Control commands:
:w write file
:wq write file and quit
:q quit
:q! quit (override checks)
:ed-cmnd run the ed command ed-cmnd
:num go to line num
ZZ same as :wq
[ Next ] [ Back ] [ UNIX/Linux Intro Start ] [ Chibcha Enterprises Home ]