25+ VI Command in Linux: Essential VI Editor Command Tutorials

VI Command List in Linux


I Command in Linux: VI editor is one of the best text editor for Linux. VI is the basic text editor comes with Linux by default. You can create a new text file, edit text file and save the edited text file. With the help of VI Commands, you can use this VI editor in essential ways. In this tutorials, we provides essential VI commands and its uses list.

Jump To:


The VI editor is one of the most famous text editors in Linux. The reason behind its famous are,

  • Comes as a default text editor in all Linux Distros.
  • Same interface and working in all distros
  • Simple and user-friendly application.
  • Supports essential file formats

The extended edition of VI editor is VIM editor(Vi Improved). The next best alternative for this text editors are Notepad++ Ubuntu, Gedit & find more text editor for Linux.

VI Command Mode:

This mode is the default mode in VI editor. In this mode, you can use the move, edit, cut, copy & paste options in VI editor. You can also use this mode to save the edited text file.

VI Insert Mode:

This mode allows you to type the text entries. Switch from command mode to insert mode by pressing the “I” letter in the keyboard. Commands are case sensitive!. To save the text file, Go to command mode by clicking the “Esc” button on the keyboard.

Launching the VI Editor:

You can create the new text file using the VI editor:

$vi sample.txt
Create new file in VI editor
Create a new file in VI editor
Check this too  How To Find Files Using "Find" Command in Linux Using Terminal Command?
  • Click the letter “I” in the keyboard will change into insert mode.
Insert mode in VI Editor
Insert mode in VI Editor
  • Enter any text inside the text area.
  • Now click the “Esc” button to get into the command mode
  • Enter the command “:wq” to save the file and quit the file.
Text file saved and quit
Text file saved and quit
  • To launch the file “example.txt”, follow the below command:
$cat exmple.txt
[email protected]:~$ cat example.txt
Tec Robust- Best Linux Tutorials

[email protected]:~$ 

VI Commands List Table:

To execute the below commands, you must use the VI command mode. The below VI commands are case sensitive.

iCommand to Insert mode
aWill enter the text after the cursor
AWill enter the text at the end of the line
ESC Exit insert mode
u Undo the last change
U Undo all the changes in the current line
oOpen a new line
Delete line
Delete 2  Consecutive lines.
D Delete contents of the line after the cursor
C Delete contents of a line after the cursor and insert new text.
Delete word
Delete 3 words
cw Change word in the line
x Delete the character at the cursor of the current line
r Replace a character in the current line
R Overwrite characters on previous characters from cursor onward
s Substitute one character under cursor continue to insert
S Substitute entire line
~ Change case of individual character in the line
k Move cursor up in the current line
j Move cursor down in the current line
h Move cursor left in the current line
l Move cursor right in the current line
Shift+zzCommand to save the file and quit
:wCommand to save the file but keep it open
:qCommand to quit without saving
:wqCommand to save the file and quit
Check this too  How to View Logged Users in Ubuntu Linux?


That’s it. As we said, VI is the basic text editor in Linux. The above list of VI commands will help you use the VI editor easily. If you have any queries related to this tutorial and then feel free to comment us below.

Leave a Reply

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

Written by Rachel

I'm Rachel, From Arizona. I am playing the "Content Management" Role in Tec Robust. I started working in TR from Jan 2019. Big Marvel Fan.

Contact me:
tecrobust [@]
Sub: Message to Rachel

Contribute Us!


LibreOffice Ubuntu- Install LibreOffice on Linux Ubuntu, Arch, Fedora, and More

Traceroute Command For Linux

Traceroute Command For Linux: Syntax & Examples