Skip to main content

Unix Fundamentals: VI

VI is a barebone text editor. It’s older than most system admins are, so pay it some respect. VI has two modes, edit mode and read mode. Unless mapped properly (and it’s likely not) arrow keys are not available in edit mode.

COMMANDS


h,l,j,k
Move cursor left, right,up,down
i
Enter edit mode
dd(#)
Delete # lines
:wq or :x or ZZ
Write, quit and exit
:#
Jump to line number #
:q!
Quit without saving
dw
Delete word
yw
Yank (copy) word
yy
Yank (copy) line
p
Put yanked text
:w name.txt
Write new file called name.txt
ESC
Enter read mode


I keep this table printed and taped to the bottom of my monitor. It saves time. 

Comments