linux how to quit vi code example
Example 1: vi 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