home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


8.3 Edit Commands

Recall that c , d , and y are the basic editing operators.

8.3.1 Inserting New Text

a Append after cursor.
A Append to end of line.
i Insert before cursor.
I Insert at beginning of line.
o Open a line below cursor.
O Open a line above cursor.
Esc Terminate insert mode.
CTRL-J Move down one line.
Return Move down one line.
CTRL-I Insert a tab.
CTRL-T Move to next tab setting.
Backspace Move back one character.
CTRL-H Move back one character.
CTRL-U Delete current line.
CTRL-V Quote next character.
CTRL-W Move back one word.

8.3.2 Changing and Deleting Text

cw Change word.
cc Change line.
C Change text from current position to end of line.
dd Delete current line.
n dd Delete n lines.
D Delete remainder of line.
dw Delete a word.
d} Delete up to next paragraph.
d^ Delete back to beginning of line.
d/ pat Delete up to first occurrence of pattern.
dn Delete up to next occurrence of pattern.
df a Delete up to and including a on current line.
dt a Delete up to (but not including) a on current line.
dL Delete up to last line on screen.
dG Delete to end of file.
p Insert last deleted text after cursor.
P Insert last deleted text before cursor.
r x Replace character with x .
R text Replace with new text (overwrite), beginning at cursor.
s Substitute character.
4s Substitute four characters.
S Substitute entire line.
u Undo last change.
U Restore current line.
x Delete current cursor position.
X Delete back one character.
5X Delete previous five characters.
. Repeat last change.
~ Reverse case.

8.3.3 Copying and Moving

Y Copy current line to new buffer.
yy Copy current line.
" x yy Yank current line to buffer x .
" x d Delete into buffer x .
" X d Delete and append into buffer x .
" x p Put contents of buffer x .
y]] Copy up to next section heading.
ye Copy to end of word.

Buffer names are the letters a -z . Uppercase names append text to the specified buffer.


Previous: 8.2 Movement Commands UNIX in a Nutshell: System V Edition Next: 8.4 Saving and Exiting
8.2 Movement Commands Book Index 8.4 Saving and Exiting

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System