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:
Command | Description |
---|---|
:wq | Save the file and exit |
:w | Save the file |
:q | Quit and Vi/Vim refuses to exit if any changes was made |
:!q | Quit without changes to save |
:a | Append after cursor |
:i | Insert after cursor |
ESC | Exit insert/overwrite mode and go back to command mode |
No comments:
Post a Comment