Wednesday, August 27, 2008

Unix commands for DBAs - Part 2


#----------------------------------------------------------------------------------
# VI edior shortcuts
#----------------------------------------------------------------------------------
Opening files:
#---------------
vi filename To open a file 'filename' with vi editor
vi + filename To open a file 'filename' with vi editor - In last line to append

Saving files:
#---------------
ESC :wq To save and exit the current open file
ESC :wq! To save and exit the current open file - forcefully (for read only files)

Modes:
#---------------
a To append after cursor
A To append at the end of line
i To insert before cursor
I To insert in beginning of line
o To add new line below cursor
O To add new line above cursor

Misc options:
#---------------
ESC :se nu To display line numbers in current open file
ESC :se nonu To turn off displaying line numbers in current open file






No comments: