When using vim, the error generally occurs in the following two situations:
(1) When you edit the same file with multiple programs.
(2) When you withdraw from the program.
The following information is prompted:
E325: ATTENTION Found a swap file by the name "/etc/systemd/system/.supervisor.service.swp" owned by: root dated: Thu Jun 28 13:18:19 2018 file name: /etc/systemd/system/supervisor.service modified: no user name: root host name: VM_0_9_centos process ID: 13409 (still running) While opening file "/etc/systemd/system/supervisor.service"
(1) Another program may be editing the same file. If this is the case, be careful not to end up with two different instances of the same file when making changes. Quit, or continue with caution. (2) An edit session for this file crashed. If this is the case, use ":recover" or "vim -r /etc/systemd/system/supervisor.service" to recover the changes (see ":help recovery"). If you did this already, delete the swap file "/etc/systemd/system/.supervisor.service.swp" to avoid this message.
Swap file "/etc/systemd/system/.supervisor.service.swp" already exists! [O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: (1) (2) The solution given by the official:
(1) To avoid two different versions of the same file, it is recommended to choose "(Q)uit" or continue to carefully modify the selection of "(E)dit anyway".
(2) You can also choose "(R)ecover" or "vim -r filename" to restore it to the unmodified state, and then delete the swp file (make sure your swp file is useless at this time).
What the bottom option means:
O: Only read, cannot be changed
E: Yes, the previous modifications are lost
R: Revert (previous modification)
D: Delete (delete the .swp file, restore the file to its original state)
Q: Exit
A: Give up
Specific solutions:
(1) If you don't want to keep the original modified content, just select D.
(2) If you want to keep the original modified content, select R to copy the modified content and save it, then exit the file and delete the awp file. (AWP files are hidden by default, view them with ls -a command, and delete them with rm commands.) )
The reason for this problem is that after the exception exits, Linux will generate a SWP file for this file, and the next edit will judge that if there is this file, it will still prompt, if you do not intend to restore the content of the old file, just delete this file, and the prompt will not appear again. If you execute the ll command under the current directory, you will not see this file, you can directly execute the command:
|