Wednesday, September 14, 2011

The Vi editor in linux

Vi editor is a text editor in linux.

Below are some useful  commands of it:


:q----> quit vi

:wq---> save the file and quit vi

:x-----> save the file if it has changed and quit vi

:q!-----> quit vi without saving changes

/and----> next occurrence of ``and'', for example, ``and'', ``stand'', ``grand''

?and-----> previous occurrence of ``and''

n---------->  repeat the most recent search, in the same direction

:g/one/s//1/g---> replace every occurrence of ``one'' with 1,

for example, ``oneself'' becomes ``1self'', ``someone'' becomes ``some1''

Enjoy:-)