Linux .swp 文件清除


[root@centos etc]# vi /etc/crontab 


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编辑器编辑文件即可。



Comments are closed.