su - at the command line. Enter your root password to get access to root. Complete documentation is available by typing: man vi
vi filename - filename is the file to be edited UNDO u - undo the last command
CTRL-l - reprint current screen CTRL-L - expose one more line at the top of the screen CTRL-E - expose one more line at the bottom of the screen CTRL-F - go forward one screen CTRL-B - go back one screen CTRL-D - page down half a screen CTRL-U - page up half a screen
j - move cursor down one line, same column k - move cursor up one line, same column h - move cursor back one character l - move cursor forward one character RET - move cursor to beginning of next line (RET is the Return key) 0 - move cursor to beginning of current line $ - move cursor to end of current line SPACE - move cursor forward one character (SPACE is the Space bar) nG - move cursor to the beginning of line n (Default is the last line of the file) :n - move cursor to the beginning of line n b - move the cursor backward to the beginning of the previous word e - move the cursor backward to the end of the previous word w - move the cursor forward to the next word /pattern - move cursor forward to the next occurrence of a pattern ?pattern - move cursor backward to the next occurrence of a pattern n - repeats the last / or ? pattern search.
a - append text after the cursor (press ESC key to terminate the command) A - append text at the end of the line (press ESC key to terminate the command) i - insert text before the cursor (press ESC key to terminate the command) I - insert text at the beginning of the line (press ESC key to terminate the command) o - open a new line below the current line for text insertion (press ESC key to terminate the command) O - open a new line above the current line for text insertion (press ESC key to terminate the command) ESC - stop text insertion. (ESC is the Escape key, on a DEC station this is the F11 key)
x - delete the current character dd - delete the current line dw - delete the current word d) - delete the rest of the current sentence D or d$ - delete from cursor to end of line P - put text back from previous delete
cw - change characters of current word (until terminated with the ESC key) c$ - change text up to the end of the line C or cc - change remaining text on current line (until terminated with the ESC key) ~ - change case of the current character xp - transpose current and following characters J - join current line with next line s - delete the current character and go into insertion mode rx - replace the current character with x R - replace the following characters (until terminated with the ESC key)
yy - put the current line in a buffer (does not delete the line from its current position) p - places the line in the buffer after the current position of the cursor
:R filename - insert the file filename where the cursor was before the : was typed
ZZ - exit vi and save changes :wq - write changes to current file and quit editing session :q! - quit editing session (no changes are made) |
No comments:
Post a Comment