After editing in vi, first press the ESC key to return to the command mode, then enter: w to save, or enter: wq! to save the file and exit.
The following is the save command:
:w Save the file without exiting vi
:w file Save the modifications to file without exiting vi
:w! Force save without exiting vi
:wq Save the file and exit vi
:wq! Force save the file without exiting vi
:q Do not save the file , exit vi
:q! Do not save the file, force exit vi
:e! Abandon all modifications
Recommended learning: Linux video tutorial
The above is the detailed content of How to save files edited by vi in linux. For more information, please follow other related articles on the PHP Chinese website!