VI editor September 28th, 2010
Open
vi filename
Close/Quit/Quit without save
:q = close the file, if you didnt modified anything
:q! = close the file even u modified and dont want to save it
:
Save/ Save quit
:wq = save and exit
= save and stay
Add
i = from cursor before start append
I = begin of line allow appending
a = after cursor append
A =end of line append
o = new line
O =before cursor new line
Edit
r = from cursor character edit
R = replace from cursor anything on type, until esc pressed
cw = word replace
Del
dd = entire line delete
x = single character
dw = single word
D = remaining of the line starting with current cursor position
Cut/Past
yy = copy the current line into the buffer
Nyy or yNy = copy the next N lines, including the current line, into the buffer
p = paste the line in the buffer into the text after the current line
Searching
/string = search forward for occurrence of string in text
?string = search backward for occurrence of string in text
n = move to next occurrence of search string
N = move to occurrence of search string in opposite direction
Line numbers:
: .= returns line number of current line at bottom of screen
:= returns the total number of lines at bottom of screen
^g provides the current line number, along with the total number of lines, in the file at the bottom of the screen
Posted in CentOS, debian, fedora, feebsd, linux, Networking, ubuntu | No Comments »

