Steps of how to quit or exit vi or vim editor
You can save and quit the vi or vim editor with saving any changes you have made by doing the following steps :
- If you are currently in insert or append mode, press Esc key on our keyboard
- Press : (colon). cursor should reappear at the lower left corner of the screen beside a colon prompt.
- Enter the following command press Enter key:
- :x<Enter> quit vi, writing out modified file to file named in original invocation
- :wq<Enter> quit vi, writing out modified file to file named in original invocation
- :q<Enter> quit (or exit) vi
- :q!<Enter> quit vi even though latest changes have not been saved for this vi call
This will quit the editor, and all changes you have made to the document will be saved to the file.