Select Page

Vi Basic Commands

To launch the vi Editor:
– Open the Terminal (CLI).

To edit or view a current file:
– Type vi filename.extension (e.g vi vnstat_Jan.sh where vnstat_Jan is the filename while sh refers to
shell script extension).

 

KeystrokesAction
iInsert (goes into insert/input mode)
ato append
AAppend at End Of Line
EscTo end input
uUndo last command
UUndo all changes to the entire line
oOpen a new line (goes into insert mode)
dd
3dd
Delete line
Delete 3 lines.
DDelete contents of line after the cursor
CDelete contents of a line after the cursor and insert new text. Press ESC key to end insertion.
dw
4dw
Delete word
Delete 4 words
cwChange word
xDelete character at the cursor
rReplace character
ROverwrite characters from cursor onward
sSubstitute one character under cursor continue to insert
SSubstitute entire line and begin to insert at the beginning of the line
~Change case of individual character
(press esc) :wSave the file but keep it open
(press esc) :q
(press esc) :q!
Quit without saving
(press esc) :wqSave the file and quit
Get Started Today!

VantageVPS Limited

16E, Neich Tower,
128 Gloucester Road,
Wanchai, Hong Kong

Sitemap

Join Our Community

Join our mailing list to receive the latest news and updates from us

Payments accepted