The blog provides Network Security Tips, Tricks, How To/Procedures. Products and areas not limited to Firewalls, Security, Check Point, Cisco, Nokia IPSO, Crossbeam, SecurePlatform, SPLAT, IP Appliance, GAiA, Unix/Linux.

Linux/Unix - vi Editor Quick Reference Command List

vi editor quick reference command list covering search functions, move and insert text, save file and exit, control edit session, screen/line movement, word movement, search functions, delete text, cancel edit function, copy and insert text, add/append text, add new line, search functions and change text.


Command
Description
/text
Go forward to text
?text
Go backward to text
:2,6d
Delete line 2-6
:3,7m 10
Move line 3-7 to 10
:3,6t 12
Copy lines 3-6 to 12
:2,6w file
Write lines 2-6 to file
:w
Write to disk
:w file
Write to file
:w! file
Write absolutely
:wq
Write and quit editor
:q
Quit editor
:q!
Quit and discard
:e!
Discard buffer
:set nu
Display line number
:set nonu
Turn off line number
:set all
Show all settings
:set list
Display invisible characters
:set wm=3
Wrap line 3 spaces from right margin
j
Move cursor down
k
Move cursor up
h
Mover cursor left
l
Move cursor right
0
Go to line start (zero)
$
Go to line end
G
Go to last file line
w
Go to forward 1 word
b
Go to backward 1 word
n
Repeat previous search
N
Reverse previous search
x
Delete 1 character
dw
Delete 1 word
dd
Delete 1 line
D
Delete to end on line
d0
Delete to start of line
dG
Delete to end of file
u
Undo last change
.
Do last change again (period)
Y
Yank a copy
7Y
Yanka a copy of 7 lines
p
Put below cursor
P
Put above cursor
a
Append after cursor
A
Append at line end
i
Insert before cursor
3i
Insert text 3 times
I
Insert at beginning of line
o
Open a line below cursor
O
Open a line above cursor
cw
Change a word
5cw
Change 5 words
C
Change line
r
Replace one character
R
Replace/type over line
Linux/Unix - vi Editor Quick Reference Command List Linux/Unix - vi Editor Quick Reference Command List Reviewed by Admin on 12:48:00 Rating: 5