Home > Article > Operation and Maintenance > How to save modified files in linux
How to save modified files in Linux: 1. Use the ":w" command, which is used in conjunction with the vi command to save the modified file without exiting the vi command; 2. Use the ":wq" command , this command means to save the modified file and exit the vi command.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
Edit mode
After using vi to enter the text, press i to start editing the text
Exit edit mode
Press the ESC key, then:
Exit vi
:q! Do not save the file, force exit vi command
:w Save the file without exiting the vi command
:wq Save the file without exiting the vi command
When interrupting vi mode, then enter vi to save the error:
If you do not need to save the last edited content, delete the temporary file directly: rm .my.cnf.swp
(Then the system prompts whether to confirm the deletion: rm: remove regular file `.my.cnf.swp' ?)
Enter y directly and press Enter, as shown in the figure below
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to save modified files in linux. For more information, please follow other related articles on the PHP Chinese website!