How to use vi text editor

Vi is a very popular text editor in Linux Systems. Its very worth full to learn vi, because almost all of the Linux systems text editor for command line is vi. So learning vi is very very useful. Its very useful for programmers, system administrators, network administrators,etc. Vi has 3 mode of operations. In this post, I will help you learnt the two modes of vi which are the frequently used vi modes. They are the command mode and the insert mode.

To get started type: vi file.txt this command create a new file 'file.txt' if it doesn't exist. If it exists then it will open the file. As soon as the file is opened or created the mode of vi is command mode where we can type specific commands for specific operations. To type some contents in the file or edit the content we need to hit the key 'i'. This takes us in insert mode. In insert mode, we can type whatever we want. To get out of the insert mode we use the key 'Esc'. This brings us back to command mode. In insert mode, we can use the 'up', 'down', 'left' and 'right' key to navigate. And from command mode the file can be saved by pressing the keys ':w' and hitting enter key. To quit from vi, from command mode use the keys ':q' and hit enter.

I have also attached a YouTube video here in this post:

Comments

Popular posts from this blog

Automate file upload in Selenium IDE

How To Install and Configure Nextcloud