|
故障:在使用vim编辑nginx的配置文件的时候,一直出现swp文件已存在的现象:
在使用vim编辑某文件的时候,会产生一个swp文件
.FILENAME.swp
在正常编辑结束退出的时候,该文件会被自动删除
E325: ATTENTION
Found a swap file by the name "/etc/.hosts.swp"
owned by: root dated: Wed Nov 25 13:01:02 2020
file name: /etc/hosts
modified: YES
user name: root host name: strong
process ID: 70264
While opening file "/etc/hosts"
dated: Fri Jul 31 14:39:45 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:
解决办法:
[root@strong etc]# ll -a .hosts.swp
-rw-r--r--. 1 root root 12288 Nov 25 13:01 .hosts.swp
[root@strong etc]# rm .hosts.swp
rm: remove regular file ‘.hosts.swp’? yes
[root@strong etc]#
[root@strong etc]# vim hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.145 strong
192.168.0.156 sztech
~
~
~
[root@strong etc]# cat hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.145 strong
192.168.0.156 sztech
|
|