
These are the following default keys for navigation: It is important to be in the command mode in order to move within a file. Note: Commands in VI editor are case-sensitive, so it is important to use the commands in the right letter-case. Substitute the entire line and begin to insert at the beginning of the line Substitute one character under cursor continue to insert Write at the end of the line (goes into insert mode)ĭelete contents of the line after the cursorĭelete contents of a line after the cursor and insert new text. Write after the cursor (goes into insert mode) These are the following VI Editing commands along with their description: Command Now the vi editor will open in the command mode.Īlso Read: Unix vs Linux: Comparison Between Unix and Linux.These are the following steps that are to be followed in order to create a new file: Press the Esc key, to get out of the insert mode and back to command mode.Now, whatever you type in this mode is interpreted as input and finally, it is put in the file.To come in insert mode you simply press I on the keyboard.These are the following features of the insert mode: This mode allows you to insert text into the file. It saves the changes you have made to the file.It allows you to cut, copy, paste, or delete a piece of text.This mode can only understand commands.These are the following features of Command Mode: When vi starts up, it is in Command Mode. For that, just type 'i' and you'll be in insert mode. You have to be present in the insert mode in order to enter the text. Insert Mode: In insert mode, the text will be inserted into the file.īy default, the vi editor starts in the command mode.Command Mode: In command mode, actions are taken on the file.There are two modes of operation of VI editor:

It works the same across different platforms and distributions.It is available in almost all Linux Distributions.These are the following reasons why VI editor is popular: An improved version of vi editors is vim.

It is a user-friendly and very powerful application that is available in all Linux distros. VI in the vi editor stands for Visual Editor. The default editor that comes with the UNIX operating system is called vi.
Vi text editor how to#
In this article, we will discuss what is a vi editor, its mode of operation, how to use it, its different editing commands, how to move within the file, and how to save it. You can also enter the insert mode by pressing a, A, o, as required.Are you also thinking about what the vi editor in Linux are and how to work in the vi editor? If yes, then don't worry because this article is for you. Make sure you press the right command otherwise you will end up making undesirable changes to the file.

VI editor is case-sensitive so make sure you type the commands in the right letter-case. Note: You should be in the “ command mode” to execute these commands. ~ – Change case of individual character.S – Substitute entire line and begin to insert at the beginning of the line.s – Substitute one character under cursor continue to insert.R – Overwrite characters from cursor onward.C – Delete contents of a line after the cursor and insert new text.D – Delete contents of line after the cursor.o – Open a new line (goes into insert mode).U – Undo all changes to the entire line.A – Write at the end of line (goes into insert mode).a – Write after cursor (goes into insert mode).i – Insert at cursor (goes into insert mode).
