VI Editor Commands with description – Linux/Unix

Prem Tiwari - - General

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

Prem Tiwari

Prem Tiwari is the founder of and also a professional developer and a blogger by hobby.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.