Unix Commands

Post date: Feb 17, 2011 5:13:45 AM

vi-commands

h                top of the current page

nH              'n' lines from top of current page (10H)

M               middle of the current  page

L                bottom of the current page

nL              'n'lines from bottom of the current page (example: 10L go to 10 lines from the top)

^R,^L           refresh sceen

$                end of the current line

^                beginning of current line ( first non-blank character )

0               ( zero ) first charecter of current line

^D              down half page

^U              up half pege

^F              forward one page

^B              backward one page

G               end of file

nG             line number 'n'

h               left one charecter

j               down one line

k               up one line

l               (ell) right one charecter

<Ret>       (Return or Enter) forward one line

-               backward one line

              (backspace) left one charecter

spc           (spacebar) right one charecter

i           insert (before the current charecter)

a          append (after current charecter)

I           (capital i) inserte at the begining of the current line

A         append at the end of current line

x           delete the charecter on the cursor

X           delete the charecter after the cursor

o           open new line after current line

O          open new line befor the current line

<SHIFT>+ ~ change case of current charecter

n<SHIFT>+ ~ change the case of n charecters following

Delete and Replace Commands

dd          delete current line

cc          change current line

r            replace curent charecter

R           overwrite line (starting from the current cursor position)

s            substitute the current chrecter by one or more charecters

ns          substitute 'n' charecters (starting from current) by one

              or more charecters

u            undo last change

U           undo changes made to the curent line

.            (dot) redo last change

w,W      move cursor forward by one word

b,B       move cursor backward by one word

e,E       move cursor to the end of the current word or if it already

            exist,to the end of next word

)           move forward one sentence

)           move backward one sentence

 

Find Operation Commands:

fx         find next occurance of charecter 'x'

Fx        find previous occurance of charecter'x'

;           (semi-colon) repeat search in forward direction

,           (comma) repeat search in backward direction

tx         stops one charecter before next occurance of charecter'x'

Tx        stops one charecter after occurance

/           search the whole file for text following '/'

?          search in backward direction (otherwise same as '/')

n          repeate previous search

N         repeate the previous search in the opposite directiuon

''          (two single quotes) go back to the line on which the

           cursor was before the search

p         (purge) put the most recent deleted text after the current

           line/charecter

P        put before the current line or charecter

yy       yank or copy line

nyy     copy n lines

>       shift right by 8 charecters

<       shift left by 8 charecters

File Transaction Commands: 

%/s/old_text/new_text/g         change all occurences (global) of

                                            old_text to new_text in the whole file

%/s/old_text/new_text/c         confirm before changing each line

%/s/old_text/new_text/p         print each line as it goes

:g/old_text/s//new_text/g

:g/^(start of each line)/s//new_text/g

:g/$(end of each line)/s//new_text/g

:g/\/oping\/ingres\/files.old/s//\/oping\/ingres\/files/g