How to use VIM the minimum basics on Linux shell?

What is VIM ?

Vim is a command line interface text editor/reader which is quite popular and frequently found on most servers.

Installing Vim on your Linux desktop or server :

In Debian/Ubuntu :

#apt-get install vim

In Centos/Redhat :

#yum install vim

Now that we have ensured that we have vim installed on our system let’s start :

To open a file with vim type :

vim test.php

To close/exit  without saving the file :

Press Esc key once then press ” : “on the keyboard you will notice a change below at your left of your screen :



Type ” q ” and press enter. that command will quit the editor.

If you get that message below :


It means that something has been modified in the file and a regular ” :q ” will not be sufficient to exit the file. Now you have 2 choices either you save the modification “:w” and you press ” :q ” again or you force quit the file by doing this ” :q! “, it will cancel all the modifications made in file after the last save.

How to insert data in the file :

vim index.php

Press ” i ” on the keyboard :



Now you have entered Insertion mode, Use your arrows on you keyboard to navigate and backspace to delete text and keys to insert  data. Press Esc key to come out of the insertion mode, you will see that the insert at the bottom will disappear.

After you have modified the file you now need to save the modification made to the file. Press Esc key to come out of the insertion modePress ” :w ” to save the file


Press Enter.


This means that the file is saved. Now you can quit your file by pressing  ” :q “. You are done !!!.

Here are some tips while using Vim:

You can make “combos”  here is an example : by pressing ” :wq ” ;this means that you are saying to VIM write the modifications to the file and quit after.


One more thing if you inverse the command it won’t work eg. ” :qw ” you will get an error :


You are saying to vim to quit first and save the file :D, you can’t close the file and save the changes after.

One last thing how to paste a paragraph into your file opened with vim :

vim index.php

Now type this ” :set paste “, Press Enter and Press “i” , Now you are in insert paste mode :


Right-click on your mouse and paste the content of your text. Press Esc to exit the insertion mode. Press “:wq” to quit the editor here you are.

This tutorial shows the strict minimum on how to use vim. I can assure you that VIM does not  just do that :D, the beauty of vim is still unveiled in this tutorial.

Drop me questions guys if you got any problem, I will be happy to answer you.

Article by Ash

“Your eyes can deceive you. Don’t trust them.” – Obi-Wan Kenobi