linux how to exit vi code example
Example 1: vim discard changes and quit command
Vim editor:
Insert: hit I key
Discard and exit: esc q!
Save and exit: esc qw
Example 2: how to exit vi in linux
(without saving changes)
if in insert or append mode press Esc.
else type ":q!" and press Enter