Monday, March 11, 2013

Commands Vi/Vim editor

As system administrator, I have needed to edit configuration files of some services such as DNS (Domain Name System), LDAP (Lightweight Directory Access Protcol) and etc.

The editor I was using frequently was nano and rarely I used pico. All those editors were used on Ubuntu. When I decided to fit in CentOS, I noticed that I had to install package nano. But I did not want to! I wanted to vary and then I searched and found editor Vi (also it is equal to Vim, although Vim has more features than Vi). I confess, at first time, it was very confused. I did not know what commands to edit file and much less how to save the changes and exit. So I googled and found some commands useful to edit files.

Hereafter, you will see a list of commands to Vi/Vim editor:

:wqSave the file and exit
:wSave the file
:qQuit and Vi/Vim refuses to exit if any changes was made
:!qQuit without changes to save
:aAppend after cursor
:iInsert after cursor
ESCExit insert/overwrite mode and go back to command mode

No comments:

Post a Comment