how to quit vi in terminal code example
Example 1: vim quit
# ESC to start command prompt, then
:q! # exit vi without saving
:wq! # exit vi with saving (! means exiting even if file is read only)
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