In centos, the command to exit without saving after vi editing is ":q!"; "q" in this command means leaving vi, and "!" often has a mandatory meaning in vi. If it has been modified If you don't want to save the file, you can use this command to force the file to leave without saving it.
The operating environment of this article: centos 6.4 system, Dell G3 computer.
To edit, first enter the letter i to enter the vim editing state
After editing, press the ESC key to exit the editing state and then Use the ":q" command not to save the file and exit vim or use the ":q!" command not to save the file and force quit vim.
Extension:
:w Save the file without exiting vi
:w file Save the modifications to file without exiting vi
:w ! Force to save and not exit vi
:wq Save the file and exit vi
:wq! Force save the file and exit vi
Recommended tutorial: "centos tutorial"
The above is the detailed content of What is the command to exit vi without saving in centos?. For more information, please follow other related articles on the PHP Chinese website!