4 Basic Vi Editor Command Sections for Faster Text Editing
We are going through simple necessary Vi editor commands for fast traversal in between the text and manipulate the text easily. Of course, there are too many commands to learn with Vi commands but the below commands will surely help you to just get started with it when you do not know how do I traverse/edit a file when you ssh
into a machine.
Before we get started, here is some basic context about the Vi editors.
Vi editor has 2 modes:
- Command Mode — Command mode is the mode where you can traverse, delete, copy, paste and do various other tasks but entering text. If you have a file named
sample.txt
for example, then simply doingvi sample.txt
gets you into the Command Mode. - Insert Mode- Insert Mode gives you all you need what you can get a normal text editor except using your mouse to navigate. Navigation can be done through arrow keys, enter text anywhere. To switch to the Insert Mode, all you got to do is press
i
. To switch back to the Command Mode, pressEsc
.
The best way to try out all the commands will be to create a sample text file with dummy text in it. With that, you will have an hands-on of all the commands for the Vi editor.
Let us go through the basic commands with the following sections: