Home > centOS, Fedora 12, Solaris, Ubuntu, Unix/Linux > centOS – VI

centOS – VI

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


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

r = from cursor character edit
R = replace from cursor anything on type, until esc pressed

cw = word replace


dd = entire line delete

x = single character

dw = single word

D = remaining of the line starting with current cursor position


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


/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


:set number or :set nu or :set nu!
:syntax on (on vim)

:>>> to indent

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: