How to exit Vim editor

When you are using the VIM editor on Linux and you would like to exit, you just need to follow the tips below. First press the Esc key in order to access the Normal mode. Now to access the Command-line mode, you can just type in : .

You will then notice a colon (:) that pops up at the bottom of your current screen session. This will allow you to execute one of the following most used commands using the Enter key :

  • :q (short for :quit) : used to quit
  • :q! (short for :quit!) : used to quit without saving the content (vim quit without saving)
  • :wq: used to write and quit (Vim save and quit)
  • :wq! : used to write and then quit even if the file has only the read permission
  • : x : used to write and then quit (looks similar to :wq, but writes in case of changes)
  • :exit : (similar to :x) used to write and then exit
  • :qa : (short for :quitall) used to quit all

Read: How to display the contents of a text file on the terminal in Linux/Ubuntu

You can also check the help documentation of Vim using the :help command to find out more about Vim editor commands.


Answer due to : dirvine


If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.


Nikolaus Oosterhof

Nikolaus holds a degree in software development and has a strong passion for all things tech-related, especially gadgets with screens. Though he is nostalgic for older phone models, he's a retired gamer and continues to enjoy programming in open-source environments. Additionally, Nikolaus enjoys writing about Linux, macOS and Windows and has experience designing web pages.

Leave a Reply