VIM editor useful commands

When you are working on a Linux server via SSH, if you do not want to lose time when editing or reading files, you should know by heart at least the basic commands to work with the file in the editor. Let's teach only useful and frequently used commands of VIM editor.



Command vi opens in console the file in a text editor VIM. If the file does not exist, it opens a blank sheet.

[root@name-of-your-server ~]# vi newfile.conf

Moving inside the file content:

Note that if you have a computer with an enlarged keyboard NumLock, ie there are additional key figures, duplicate keys PageUp, PageDown, Home, End, and arrows usualy cannot be used as commands.

Searching in the file:

Search is case sensitive, so if in an open file the required phrase is written in UPPER letters, for the searching you also should use UPPER ones.

Editing of the file (insert mode):

Do not forget to get out from insert mode before you start to use any commands of movement, searching or any other. Before you start to edit the file (especially large), the best for you solution to locate the line you want to edit, and move your cursor there, it will save you time. In edit mode, you can move through the text using only the arrows keys.

Exit from VIM editor:

There is a lot of other commands but you should not clog your brain by unnecessary information, because information becomes every day more and more.



HiTechBlog.net 2013-2024