Vi or vim is a text editor for Linux and Unix-like operating systems. It can be used to edit all kinds of plain text files. It is especially useful for editing programs or system configuration files. The basic syntax is as follows to open a file using vim:
How to exit the VIM text editor
The procedure is as follows:
- First, you need to switch to command mode. This can be done by hitting the [Escape] key. Next, you can type the following commands:
- :q to quit.
- :q! to quit without saving data/file.
- :x save and quit.
- :qa to quit all open files.
- Please note that whenever you type :, a vim or vi : will appear at the bottom of the screen. You need to type the rest of the command at the bottom of the screen.
Example: How to exit vim editor in terminal (method #1)?
Press the [Escape] key.
Type [Enter] key
vim: How do I quit from Vi (method #2)?
You can press the [Escape] key.
Type SHIFT Z Z to save and exit.
Type SHIFT Z Q to exit without saving.
Related media (Video) – Exit from the vim/vi text editor command
This tutorial is also available in a quick video format:
(Video 01: How to exit from the vim/vi text editor)