VI Text Editor With Commands
VI Text Editor With Commands
The VI editor is the most popular and classic text editor in the Linux family. Below, are some
reasons which make it a widely used editor –
3) It is user-friendly. Hence, millions of Linux users love it and use it for their editing needs
Nowadays, there are advanced versions of the vi editor available, and the most popular one
is VIM which is Vi Improved. Some of the other ones are Elvis, Nvi, Nano, and Vile. It is wise
to learn vi because it is feature-rich and offers endless possibilities to edit a file.
To work on VI editor, you need to understand its operation modes. They can be divided into
two main parts.
Command mode
Insert mode
Command mode
Insert mode
vi <filename_NEW> or <filename_EXISTING>
And if you specify an existing file, then the editor would open it for you to edit. Else, you can
create a new file.
vi Editing commands
Note: You should be in the "command mode" to execute these commands. VI editor is case-
sensitive so make sure you type the commands in the right letter-case.
Make sure you press the right command otherwise you will end up making undesirable changes
to the file. You can also enter the insert mode by pressing a, A, o, as required.
k - Move cursor up
j - Move cursor down
h - Move cursor left
l - Move cursor right
You need to be in the command mode to move within a file. The default keys for navigation
are mentioned below else; You can also use the arrow keys on the keyboard.
You should be in the command mode to exit the editor and save changes to the file.