Linux中.swp 文件的产生与解决方法

 时间:2024-10-14 12:01:36

1、我们使用vi命令编辑nginx.conf配置文件,出现如图提示,此时我们也可以直接按E键进行正常进行编辑,但是下次还是可能出现。那么产生此问题的原因是什么。如下是两种情况会产生(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 nginx.conf" to recover the changes (see ":help recovery"). If you did this already, delete the swap file ".nginx.conf.swp" to avoid this message解释一下,出现这种情况是此文件产生了交换文件,即后缀为.swp的文件1:当我们编辑一个文件的时候,另外一个人也在编辑的时候,会出现2:当我们编辑文件时候,突然断电,或者突然断网,为了防止数据丢失,也会出现这种文件

Linux中.swp 文件的产生与解决方法

3、当产生此文件时,我们可以直接rm -f.nginx.conf.swp删除此swp文件,否者每次编辑就会出现提示,但是如果是在文件编辑之后,出现非正常退出,此时我们的配置并没有保存在nginx.conf文件中,我们需要使用vi -r nginx.conf进行恢复,如图进行文件恢复,然后回车,配置就会从.swp中恢复到nginx.conf中,然后再删除.swp文件

Linux中.swp 文件的产生与解决方法
  • 使用sw绘制烛台
  • 最新qq图标点亮大全:[16]qq游戏图标点亮
  • solidworks如何用实体边线切除另一个实体?
  • Solidworks画普通平键:[1]草图设置
  • 如何解决锤式破碎机轴上零件的定位问题
  • 热门搜索
    华西村旅游 黔南旅游网 旅游互联 旅游管理信息系统 宁波旅游网 商丘旅游景点 cri环球旅游频道 澳门 旅游 北京市旅游景点 黄河旅游