Visual Editor – vi is used to edit files through SSH. It is the default text editor that comes with a UNIX system.
To start vi
vi filename
Two Modes
Insert mode
press i
i
Command mode
press Esc
Esc
Saving
Save
:w
Save and quit
:wq
ZZ
Save as
:w newfilename
:w phpinfo.php – save as phpinfo.php
Quit without saving
:q!
Moving the Cursor
Move left, one character
h
left arrow
Move right, one character
l
right arrow
Move down, one line
k
down arrow
Move up, one line
h
up arrow
Move to last column on the current line
$
Move to first column on the current line
0
zero not letter o
Move back to the begining of the previous word
b
Move forward to the beginning of the next word
w
Move forward to the end of next word
e
Move up one paragraph
{
Move down one paragraph
}
Undo
u
Finding a Word or String
Find a word going backward
?
?linux - finds the word linux, backward direction
Find a word going forward
/
/linux - finds the word linux, forward direction
Move to next occurrence of the word
n
Move to next occurrence of the word, opposite direction
N
Copying and Pasting
Copy
yy
Paste after the current line
p
Paste before the current line
P
Display current line number
^g
Ctrl g
Inserting / Insert Mode
Insert text before cursor
i
Append after cursor
a
Open and put text in a new line above cursor
O
Open and put text in a new line below cursor
o



















