To quit the Linux ’vi’ editor without saving any changes which have been made:
To Exit the insert or append mode
- From within insert or append mode, press the ‘Esc‘ key.
To Enable VI Command Line
- Press the ‘:’ (colon) Key. The cursor should reappear in the lower-left corner of the screen beside a colon prompt.
- Then, Enter the ‘q!’ Command and press the ‘Enter’ Key.
Example VI Command Line
This will quit the Linux VI editor, and all changes the document made in this session will be lost.