centos 错误解决方案

1. E325: ATTENTION

出现场景:在用vi编辑文件时 弹出提示

提示源码:

Found a swap file by the name ".nginx.conf.swp"

owned by: root dated: Thu Apr 21 10:52:35 2016

file name: /usr/local/nginx/conf/nginx.conf

modified: YES

user name: root host name: iZ2346agf7yZ

process ID: 23213 (still running)

While opening file "nginx.conf"

dated: Thu Apr 21 10:54:29 2016

NEWER than swap file!

(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 nginx.conf"

to recover the changes (see ":help recovery").

If you did this already, delete the swap file ".nginx.conf.swp"

to avoid this message.

"nginx.conf" 117L, 2649Cl

原因: 编辑文件时异常退出,而vim编辑文件时会自动创建一个交换文件.swp文件,以保证文件的安全性

所以在再每次打开这个文件都会出现这个警告,为了去掉这个警告,我们只需要删除这个swap文件即可

解决方案: ls -al (.swp是隐藏文件)

rm -f 文件名