Command to easily exit Vim / Vi without saving changes

> Command to easily exit Vim or Vi without saving changes

Command to exit Vim / Vi without saving changes

Vim is one of the popular text editors for software developers and system administrators. macOS and various Linux Distros Vim are pre-installed. In this tutorial, you will learn how to exit Vim / Vi without saving the change command.

Command to exit Vim without saving changes

Follow the instructions below to exit Vim. 1. If you are in another mode, press Esc The normal mode is set. 2. Enter the following command in Vim.

:q!

3. Finally Enter Key.

Example of exiting Vim without saving commands

First, open the file in Vim using the following command:

vim filename.extension

Press now Esc The normal mode is set.

Then, exit the editor without saving your changes by entering the following command:

:q!

Press now Enter Exit the editor.

Command to easily exit Vim / Vi without saving changes

Conclusion

In this tutorial, you have learned how to easily exit Vim / Vi without saving the change command. If you have any questions about this, please comment below.

Sidebar