Linux .swp 文件清除
在使用Linux中的VI编辑器时,由于未能正确保存当前编辑的文件而退出,在编辑的当前文件夹下会产生一个为.xxx.swp的文件,当我们再次编辑xxx文件时,系统产生一些告警提示,以下是相关提示:
[root@centos etc]# vi /etc/crontab
E325: ATTENTION
Found a swap file by the name "/etc/.crontab.swp"
owned by: root dated: Sun Jul 28 21:58:39 2013
file name: /etc/crontab
modified: YES
user name: root host name: centos
process ID: 17370 (still running)
While opening file "/etc/crontab"
dated: Sun Jul 28 22:06:16 2013
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 /etc/crontab"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file "/etc/.crontab.swp"
to avoid this message.
"/etc/crontab" 14L, 308C
不难看出,如果我们要查看我们之前保存的临时文件,可以使用命令:vim -r /etc/.crontab.swp 进行查看。
如果不需要使用之前已经编辑的文件信息,可以使用:rm -rf /etc/.crontab.swp 删除该文件,重新使用vi编辑器编辑文件即可。
这样就消除了每次编辑之前未能正常保存文件的告警提示。
『–ENDOF–』