在Linux中vim文档报错:E325: ATTENTION Found a swap file by the name “.ifcfg-ens33.swp“

报错异常:

E325: 注意
发现交换文件 ".ifcfg-ens33.swp"
            所有者: root    日期: Wed Feb  1 23:47:18 2023
            文件名: /etc/sysconfig/network-scripts/ifcfg-ens33
            修改过: 否
            用户名: root      主机名: localhost.localdomain
           进程 ID: 2860
正在打开文件 "ifcfg-ens33"
              日期: Wed Feb  1 23:51:39 2023
      比交换文件新!

(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.
    如果是这样,请用 ":recover" 或 "vim -r ifcfg-ens33"
    恢复修改的内容 (请见 ":help recovery")。
    如果你已经进行了恢复,请删除交换文件 ".ifcfg-ens33.swp"
    以避免再看到此消息。

交换文件 ".ifcfg-ens33.swp" 已存在!
以只读方式打开([O]), 直接编辑((E)), 恢复((R)), 删除交换文件((D)), 退出((Q)), 中>
止((A)):

(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 samefile 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 ./backu.sh"
If you did this already,delete the swap file "./.backu.sh.swp"to avoid this message.
Swap file "./.backu.sh.swp" already exists !
[o]pen Read-only,(E)dit anyway,(R)ecover,(Q)uit,(A)bort:

异常原因:

可能是上一次编辑ifcfg-ens33文件时强制退出,没有保存文档,导致第二次进入Linux使用vim编辑该文件时,出现上述提示

解决方法:
如果是在localhost目录下:先进入根目录下

cd /

在根目录后执行以下操作(这里是进入我所要查看的ifcfg-ens33文档所在的目录):

cd etc/sysconfig/network-scripts

然后查看所有文件:

ls -a

返回到文档上次编辑状态(为防止文档丢失,***.swp文档是系统自动为我们创建的一个副本)

vim -r  .ifcfg-ens33.swp

右下方出现以下内容:

使用交换文件  ".ifcfg-ens33.swp"
原始文件 "/etc/sysconfig/network-scripts/ifcfg-ens33"
E308:警告:原始文件可能已被修改
Recovery completed. Buffer contents equals file contents. You may want to delete the .swp file now. 
请按 ENTER 或其它命令继续

回车
查看恢复后的ifcfg-ens33文档并保存

vim ifcfg-ens33

删除交换文件.ifcfg-ens33.swp

rm -f .ifcfg-ens33.swp

结语:

著此篇,与君享,互勉之,共进步!
  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值