VI Editor Commands with description – Linux/Unix

Are you want to start learning the Linux/Unix, then this tutorial will help more. Please keep your close attention in this tutorial as I am going to share the list of VI editor commands with description.

Steps to open Vi text editor:

  1. Open your terminal (CLI)
  2. Type vi or and hit the Enter button

VI Editor Editing/Insertion Commands

CommandAction Description
i Insert at cursor mode
o Open a new line mode
a Write after cursor mode
A Write at the end of line mode
D Delete contents of line after the cursor
C Delete contents of a line after the cursor and insert new text. Press ESC key to end insertion.
ESC Terminate insert mode
u Undo last change
U Undo all changes to the entire line
dw Delete word
4dwDelete 4 words
cw Change word
x Delete character at the cursor
r Replace character
R Overwrite characters from cursor onward
s Substitute one character under cursor continue to insert
S Substitute entire line and begin to insert at the beginning of the line
~ Change case of individual character

VI Editor Saving and Closing the file Commands

Command Description
Shift+zz Save the file and quit
Shift+zz Save the file and quit
:w Save the file but keep it open
:q Quit without saving

VI Editor Moving within file Commands

Command Description
k Move cursor up
j Move cursor down
h Move cursor left
l Move cursor right

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts:


Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of FreeWebMentor.com (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.