|
|
VI
Quick Commands
VI
is the defacto-standard text editor on unix. While
the learning curve is high, once you get used to the
commands you will find that vi is a very powerful
and useful tool for the Oracle DBA. The following is a partial list of the
available vi commands.
| Starting
Commands |
 |
| Command |
Action |
| vi file |
invoke vi on file |
| vi file1 file2 |
invoke vi on multiple
files |
| view file |
read only mode |
| Exit
Commands |
 |
| Command |
Action |
| :q |
quit |
| :q! |
quit and ignore changes |
| :wq |
write and
quit |
| :w |
write file |
| :w! |
wrie file - overriding
protection |
| :w newfile |
write current file
to newfile |
| :n |
edit next file |
|
:e!
|
re-edit
current file without saving any changes |
| Move
Commands |
 |
| Command |
Action |
| h |
move left |
| j |
move right |
| k |
move up |
| l |
move right |
| w |
one word forward |
| b |
one word backwards |
| 0
(zero) |
beginning of current
line |
| $ |
end of line |
| G |
go to last line of
file |
| L |
go to last line on
screen |
| H |
go to top line on screen |
| M |
go to bottom line on
screen |
| Search
Commands |
 |
| Command |
Action |
| /<string> |
search forward for next occurance
of <string> |
| ?<string> |
search backwards for next occurance
of <string> |
| n |
repeat previous search |
| N |
repeat previous search in opposite
direction |
|
:s/A/B/opt
:%s/A/B/opt
|
substitutes string B for first instance of
string A on the current line.
substitutes string B for first instance of string A on every line.
Options:
g (change all occurences)
c (confirm prior to replace)
p (print
changed lines)
|
| Inserting
Text Commands |
 |
| Command |
Action |
| i |
insert text before
the current cursor position |
| I |
insert text at the
beginning of the line |
| a |
append text after the
current cursor position |
| A |
append text to the
end of the line |
| o |
insert a blank line
below the current cursor position |
| O |
insert a blank line
above the current cursor position |
| R |
overtype mode |
| Changing
Text Commands |
 |
| Command |
Action |
| cw |
change word |
| cW |
change word including
punctuation |
| r |
replace 1 character |
| cc |
change current line |
| C |
change to end of line |
| Deleting
Text Commands |
 |
| Command |
Action |
| x |
delete one
character |
| X |
delete character
before cursor |
| dd |
delete current
line |
| dw |
delete current
word |
| Miscellaneous
Commands |
 |
| Command |
Action |
| . |
repeat last executed
operation |
| <ctrl> f |
scroll forward one
page |
| <ctrl> b |
scroll backwards one
page |
| u |
undo most recent change |
| U |
undo most recently
deleted text |
| J |
delete return
at end of line. Join this line with the next
line |
| Y |
yank a copy
of the current line |
| p |
put buffer
contents after cursor |
| P |
put buffer
contents befor cursor |
|
|
|
|
|
|