Recently, I encountered a problem when using Vim editor. Due to the business needs of the company, I modified the configuration computer port and conducted routine terminal command line operation. As a result, I encountered an E325:ATTENTION error message, as shown below:
E325: ATTENTION
Found a swap file by the name “/etc/.hosts.swp”
owned by: root dated: Thu Mon Mar 16 15:47:09 2020
file name: /private/etc/hosts
modified: YES
user name: root host name: chenMac.local
process ID: 3200X
While opening file “/etc/hosts”
dated: Mon Sep 7 15:44:52 2020
(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/hosts”
to recover the changes (see “:help recovery”).
If you did this already, delete the swap file “/etc/.hosts.swp”
to avoid this message.
Swap file “/etc/.hosts.swp” already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:
There are two solutions to this problem. This case is based on the terminal of the Mac computer system. This is also caused by the abnormal exit when editing the file, because Vim will create a swap file to ensure the security of the file when editing the file, in order to remove the warning, you only need to delete the file. The specific operation is as follows:
Method 1: Directly in the last prompt options, press the computer keyboard “D” key, directly delete temporary files can be;
Method 2: On the Mac terminal, enter CD /usr/local/ect and press Enter. Then enter the command line :ls -a enter; Finally, run the rm -rf.hosts. SWP command and press Enter.
After the prompt is removed, modify the port of the computer. The result is not saved successfully, and the specific operation is as follows:
The above is all the content of this chapter. Welcome to pay attention to the wechat public account of Sanzhan “iOS development by Sanzhan”, and the Sina Weibo account of Sanzhan “Sanzhan 666”, welcome to pay attention to it!