Press the escape key (esc on some machines) to make sure you are in command mode (also called edit mode). In command mode type "ZZ" or ":wq". If you want to exit without saving changes, use ":q!".
I've started vi. How do I quit?
FAQ category:
Facilities
Facilities