How to exit vim? And other required commands.

Vim is the most popular Linux text editor, it was created in 1978 and is used to present days.

Vim has two modes: “Command mode” where you can insert many commands, and “Insert mode” – where you can insert and edit text document. By default Vim open all documents in “Command mode”, to enter into the “Insert mode” – press button “i“.

The most asked question is – “How to exit Vim?” – it is very simple – in Command mode enter :q! and press Enter. This command exit Vim without saving any changes.


To save file – enter command :w <filename> and press Enter:

:w file.txt

To save file and exit Vim use command :wq and press Enter