vim编辑文件警告Swap file already exists ,如何删除vim编辑产生的.swp文件?查看隐藏文件命令

vim编辑文件警告Swap file already exists,如何删除vim编辑产生的.swp文件?查看隐藏文件命令

Linux(centos7)下多个用户同时编辑一个文件,或编辑时非正常关闭,再下次编辑打开文件时均为显示如下警告信息:

E325: ATTENTION
Found a swap file by the name ".other.conf.swp"
owned by: root dated: Wed Nov 29 02:23:20 2017
file name: /usr/local/nginx/conf/other.conf
modified: YES
user name: root host name: host.localdomain
process ID: 19783 (still running)
While opening file "other.conf"
dated: Wed Nov 29 02:28:57 2017
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 other.conf"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file ".other.conf.swp"
to avoid this message.

Swap file ".other.conf.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort:

-----------------------------

使用命令查看隐藏swp文件(隐藏文件都以.开头):
ls -a
查看当前目录下与打开的文件同名的.swp文件,如.other.conf显示为.other.conf.swp
使用rm -rf删除这个.swp文件,当再打开test.xml文件时,便不会弹出警告信息。
# rm -rf .other.conf.swp

 

 

posted @   大自然的流风  阅读(26465)  评论(0编辑  收藏  举报
编辑推荐:
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
点击右上角即可分享
微信分享提示