vi or vim is a text editor. You can use it to edit configuration files. Write programs in Perl, Python, C/C++, sh/bash/ksh and more. To exit or quite the vim/vi text editor without saving any changes press:
Let us see vi and vim commands in details.
How to quit the vi/vim editor without saving your changes
You can quit the vim or vi text editor without saving any changes you may have made to the file as follows:
- First, you need to press Esc key to get out of insert or append mode.
- Next type colon (: symbol)
- You see the cursor at the lower left corner of the screen.
- Finally, type the following command to quit without saving anything to a file:
This will force vi/vim to quit the editor, and all changes you have made to the document will be lost forever. You just discards any changes you made to the file.
Getting more info on how to use vim text editor
The vim or vi text editor has three modes. It has many commands and options for both new and advanced users. I strongly suggest that you start learning vim by typing the following command at the terminal:
Vimtutor starts the Vim tutor. Very useful for people working in IT, sysadmin jobs, and developers that want to learn their first Vim commands. Many commands works with vi too.