Translate

Sunday, 27 January 2013

VI editor in RHEL 6

How to use VI editor..

To open a file use vi <filename>

e.g.

# vi test

use following key to edit the file by vi

i - insert the text at current cursor position.
I - insert the text at beginning of line.
a - appends the text after cuurent cursor position.
A - appends the text at end of line.
o - inserts a line below currnet cursor position.
O - inserts a line above currnet cursor position.
r - replace a single char at current cursor position.

Commands at execute mode

:q             - quit without saving
:q!           - quit forcefully without saving
:w            - save
:wq!         - save & quit forcefully
:x             - save & quit
:sh           - providing temporary shell
:se nu      - setting line number
:se nonu   - removing line number

No comments:

Post a Comment