vi Save and Exit
Linux Commands - Shells

Saving and Exiting
You've seen that you can use the ":q" command to exit, and the ":w" command to save a file. You can combine these commands to save and exit at the same time.

 


:wq

vi save



 

vi

 


Or, you can use either one of these commands to save and exit at the same time:

:x

or

SHIFT ZZ

If you've edited a file, and try to exit by entering the ":q" command, you'll get an error message. To exit vi without saving the file, enter:

:q!

 

 


Copyright CyberMontana Inc. and BeginLinux.com
All rights reserved. Cannot be reproduced without written permission. Box 1262 Trout Creek, MT 59874