The command to quit vi without saving any changes made during the current editing session is:
:q!
Here, :q
means quit, and the exclamation mark !
forces vi to quit even if
there are unsaved changes, discarding those changes
. To use this command, first press the Esc
key to ensure you are in normal
(command) mode, then type :q!
and press Enter. This will exit vi immediately
without saving any modifications made since the last save or since opening the
file