Linux Scroll

Just another site

vi Editor



i = insert mode

a = append after cursor
I = insert at beginning of current line
A = append at end of current line

Changing characters, words, and lines

r = replaces the current character

R = overtype mode, press ESC after you done
cw = replace the current word, press ESC after you done


x = delete a character

X = delete a character before the cursor
dd = delete a line
dw = delete a word
D or d$ = delete the rest to the end of line
4x = delete 4 characters
4X = delete the 4 characters before the cursor
3dw = delete 3 words
5dd = delete 5 lines

Copy paste (y=yank):

yy = copy a line

yw = copy a word
p = paste
P = paste before the cursor
7yw = copy 7 words
3yy = copy 3 lines


/pattern = search pattern

?pattern = search pattern (backward)
n = repeat search
N = repeat search (backward)


u = undo last change

U = undo last change to the current line
uu = undo the undo



:wq or 😡 or ZZ = save and quit vi
:w = save
:w filename = save to new filename



:q = quit vi
:q! = quit vi without save changes
:e! = reads the original file so that you can start over

Insert blank line:

o = insert a blank line

O = insert a blank line above the line cursor located

Arrow key:

k = up

j = down
h = left
l = right

Joining lines:

J = move a line up to merge 

4J = move a 4 lines up to morge

Moving around words:

w = moves to next word 

b = oves to the beginning of the current word
e = moves to the end of a word
W, B, E = ignore punctuation

Moving around lines:

$ = move to the end of a line

0 = move to the beginning of a line

Moving around screen/page:

H = move to top of the screen

M = move to middle of the screen
L = move to last line of the screen

1G = move to top of the line
G = move to end of the file

Ctrl-b = PgUp
Ctrl-f = PgDn
Ctrl-u = PgUp half
Ctrl-d = PgDn half

Repeat a command:

. (dot) = repeat previous command


:sh = escape temporarily to a shell

^d = return from shell to vi

:!command = execute UNIX command without leaving vi
:r!command = read output of command into vi
:^g = list current line number
:set number = show line numbers

Leave a Reply

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

You are commenting using your 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: