UNIX VI Editor Commands

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

General Moving Around Editing Files

[ESC] Exit any mode wb Move forward or backward by word ia Insert before or after curson position

Return file to state at last save e Move to end of word IA Insert at start or end of line
:e!
[undo all]
nG Goto to line n Open new line above or below
oO
current line
G Goto to last line in file
r Replace character
Opening Files Move to the beginning of the
)(
previous or next sentence cw Change word
vi filename Open filename
Move to top (highest,) middle or last cc Change current line
HML
vi filename1 filename2 Open specified filenames line of screen
R Overwrite
Open filename in read- Goto first nonblank character of
view filename ^ x Delete character above cursor???
only mode current line

vi + filename Open filename at last line Goto first nonblank character of dw Delete word
+-
previous or next line
vi -r List recoverable files dd Delete current line
[CTRL] F Move forward one screen
vi -r filename Recover filename
[CTRL] B Move backward one screen D Delete to end of line

[CTRL] U Move up half a screen u Undo last edit


Searching [CTRL] D Move down half a screen U Restore current line

/string Search forward for string z [RETURN] Put current line at top of screen

?string Search backward for string z. Put current line at middle of screen
Closing (Quiting) & Saving Files
Repeat last search forward or z- Put current line at bottom of screen
nN
backward ZZ Save and close file

Search forward or backward for x in :w Save file


fx Fx
current line
Copy (Yank) & Paste :q Close (quit) file

yw Copy word :n Edit next file

yy Copy line

pP Paste text after or before cursor


Steven Iveson 2005

You might also like