当我们用vim编辑编辑文件时,遇到死机,需要再次用xshell打开一个新的ssh连接(也就是两个ssh同时打开一个文件),
系统就会在源文件目录下自动创建一个.xxxx.swp结尾的缓存文件,当我们用vim再次打开源文件是会报故障提示:
实例:
[root@www ~]# vim /etc/named.rfc1912.zones
E325: ATTENTION
Found a swap file by the name "/etc/.named.rfc1912.zones.swp"
          owned by: root   dated: Thu Feb 25 13:26:28 2016
         file name: /etc/named.rfc1912.zones
          modified: no
         user name: root   host name: www.luxing.com
        process ID: 3704 (still running)
While opening file "/etc/named.rfc1912.zones"
             dated: Thu Feb 25 13:26:16 2016
(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/named.rfc1912.zones"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file "/etc/.named.rfc1912.zones.swp"
    to avoid this message.
Swap file "/etc/.named.rfc1912.zones.swp" already exists!
1.先查看目录
[root@www etc]# ls -a
.                          depmod.d                 issue.net         named.rfc1912.zones           .pwd.lock       shells
..                         dhcp                     kdump-adv-conf    named.rfc1912.zones.bak       quotagrpadmins  skel
abrt                       DIR_COLORS               kdump.conf        .named.rfc1912.zones.swp      quotatab        smartd.conf
acpi                       DIR_COLORS.256color      krb5.conf         named.root.key                rc              sos.conf
adjtime                    DIR_COLORS.lightbgcolor  latrace.conf      nanorc                        rc0.d           ssh
aliases                    dracut.conf              latrace.d         NetworkManager                rc1.d           ssl
aliases.db                 dracut.conf.d            ld.so.cache       networks                      rc2.d           statetab
alsa                       environment              ld.so.conf        nsswitch.conf                 rc3.d           statetab.d
alternatives               ethers                   ld.so.conf.d      ntp                           rc4.d           subversion
anacrontab                 event.d                  libaudit.conf     ntp.conf                      rc5.d           sudo.conf
asound.conf                exports                  libibverbs.d      openldap                      rc6.d           sudoers
2.执行删除命令:
[root@www etc]# rm .named.rfc1912.zones.swp 
rm: remove regular file `.named.rfc1912.zones.swp'? y
3.再次打开,没有问题
[root@www etc]# vim named.rfc1912.zones