How do I exit the VIM text editor on a Linux/Unix-like operating systems? How to exit Vim editor?
This guide is for you.
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, scrpits or system configuration files located in /etc/ or /usr/local/etc/ directories.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform Linux related Tasks.
In this context, we shall look into how to use the VIM text editor.
The process to quit vim/vi text editor is shown below;
i. First, you need to switch to command mode. This can be done by hitting the Esc key. Next, you can type the following commands:
ii. :q to quit.
iii. :q! to quit without saving data/file.
iv. :x save and quit.
v. :qa to quit all open files.
vi. 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.
Now, we will see some instances to exit from vim session.
To do this;
i. Press the Esc key.
ii. Type :
iii. Next, type q
iv. Hit the Enter key
To do this, follow the steps below;
i. You can press the Esc key.
ii. Type SHIFT Z Z to save and exit.
OR
Type SHIFT Z Q to exit without saving.
You can use vimtutor command to know more about vim. It starts the Vim tutor.
The Vimtutor is useful for new Linux or Unix sysadmin or developers who want to learn their first Vim commands. By default, vimtutor starts in English or the language of the current locale will be used:
$ vimtutor
To start in other languages add language parameter as follows:
$ vimtutor it ## Italian ##
$ vimtutor es ## Spanish ##
$ vimtutor fr ## French ##
To see all installed languages run the following ls command:
$ ls /usr/share/vim/vim*/tutor/tutor*