≡ Menu

Vi / Vim: Quit Without Saving Command

I am a new vi / vim text editor user. How can I quit the vi / vim text editor without saving my changes to a file under Linux / Unix like operating systems?

You can quit the vim or vi text editor without saving any changes you may have made to the file. 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:

q!
WARNING! This will force vi/vim to quit the editor, and all changes you have made to the document will be lost forever..
Fig.01: Vim / vi text editor quit without saving changes command demo

Fig.01: Vim / vi text editor quit without saving changes command demo

Share this tutorial on:
{ 4 comments… add one }
  • The Brain June 22, 2013, 4:07 am

    Thank you!

  • mohamedabdallah November 17, 2013, 12:00 pm

    :wq

    • Sasha July 15, 2015, 1:33 am

      I believe that’s the opposite of “Vi / Vim: Quit Without Saving Command”

  • Korian March 19, 2015, 9:29 pm

    :q!

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">


   Tagged with: , , , , , , , , ,