报错异常:
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
结语:
著此篇,与君享,互勉之,共进步!