The vi editor stands for the visual editor. It is installed in every Unix system. The vi editor has two modes:
- Command Mode: In command mode, actions are taken on the file. The vi editor starts in command mode. Cut, copy the text and save the file; commands are case sensitive.
- Insert Mode: In insert mode, entered text will be inserted into the file. The Esc key will take you to the command mode from insert mode.
Creating a new file name
To enter in insert mode
Now you are in insert mode. You can also enter to insert mode in other ways.
Just type the content to the file in insert mode, and if you Wanna go back to command mode press
Want to discard the changes in your line
Go to command mode and press
Note — Below command will work in command mode which you know how to navigate? If you are in insert mode by pressing escape key.
Save the file
Quit the file without saving
Save and Quit the file
Save and Quit the file with permissions such as nonwritable file
— Let me know if facing any doubts or needs to be corrected.