James H. Zisch - Computer Services

Support : Guides

 

The "vi" editor is resident on most all UNIX and Linux standard operating systems. It is a "line editor" as opposed to being a full screen editor. There are also PC version available for use on Windows operating systems. For web administration of UNIX and Linux platforms, the following commands will assist you in being able to perform basic text file modifications when no full screen editor is available on the system.

Change*

cw  word

cc  line

C  rest of line

R  Replace Characters

Insert*

a  after cursor  

A  at end of line  

i  before cursor

I  beginning of line

o  open line below

O  open line above

yw  yank word

yy ( y )  yank line

p  put below cursor

P  put above cursor open line above

Delete

dw  word

dd  line

D  rest of line

x  under cursor

X  before cursor

xp  transpose

r  replace character

Move

k  line up  

^D  scroll down

j  line down  

w  word forward

l  right space  

b  word back

h  left space  

e  end word

O  beginning of line  

G  end of file

$  end of line  

nG  n number of lines

Other

u  undo

/  find down

n  next

.  repeat

?  find up

J  join next line

ex Commands

:se nu  set numbers

:se nonu  no numbers

:r file  read in file

:!cmd  run command

Save/Quit

:w  write the file

:q!  abandon changes not saved

ZZ  writes and quit

*To tell vi that you want to stop inserting text, press ESC.