Linux-Unix: VI editor

VI Editor commands:

Use [escape] key after completion of every input task!

[ctrl]-F        Move forward one screen.
[ctrl]-B    Move backward one screen.
$     Move cursor to end of line.
^     Move cursor to beginning of line.
:1     Move to first line of file
:$     Move to last line of file
/     Search for a character string.
x     Delete the character at the cursor position.
dd     Delete the current line.
p     Paste data that was cut with x or yy commands.
u     Undo
.    execute the same command
cw    change word
yy    copy one line
5yy    copy 5 lines

a         Add text after the cursor.
i         Insert text before the cursor.
R         Replace text starting at the cursor.
r        Replace just one character
o         Insert a new line after the current one.
O        Insert a new line before the current

:w         Save file to disk, without exiting editor.
:wq!        Save and exit
[shift]+zz     Save the file and exit.
:q!         Quit without saving.

Leave a Reply