linux下vi编辑某文件时,操作出现 错误提示: E325: ATTENTION 2, Found a swap file by the name ".p1.c.swp"

简介: 当我在linux下用vi打开p1.c文件时 root@iZ2zeeailqvwws5dcuivdbZ:~/1/01/指针# vi p1.c 会出现如下信息: 1 E325: ATTENTION 2 Found a swap file by the name ".

当我在linux下用vi打开p1.c文件时

root@iZ2zeeailqvwws5dcuivdbZ:~/1/01/指针# vi p1.c

会出现如下信息:

 1 E325: ATTENTION
 2 Found a swap file by the name ".p1.c.swp"
 3           owned by: root   dated: Fri Jan  5 19:57:58 2018
 4          file name: ~root/1/01/指针/p1.c
 5           modified: YES
 6          user name: root   host name: iZ2zeeailqvwws5dcuivdbZ
 7         process ID: 10876
 8 While opening file "p1.c"
 9              dated: Fri Jan  5 19:51:30 2018
10 
11 (1) Another program may be editing the same file.  If this is the case,
12     be careful not to end up with two different instances of the same
13     file when making changes.  Quit, or continue with caution.
14 (2) An edit session for this file crashed.
15     If this is the case, use ":recover" or "vim -r p1.c"
16     to recover the changes (see ":help recovery").
17     If you did this already, delete the swap file ".p1.c.swp"
18     to avoid this message.
19 
20 Swap file ".p1.c.swp" already exists!
21 [O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort: 
上面的两段话(1)(2)的翻译是:
(1)另一个程序可能正在编辑同一个文件。 如果是这种情况,请注意在进行更改时不要以相同文件的两个不同实例结束。 退出,或继续谨慎。
(2)此文件的编辑会话崩溃。如果是这种情况,请使用“:recover”或“vim -r p1.c”来恢复更改(请参阅“:help recovery”)。如果已经这样做, 删除交换文件“.p1.c.swp”以避免此消息。

原因是我之前有一次使用vi 操作 p1.c 文件时出现了异常中断,与服务器中断连接了,所以我重新连接服务器后,用 i p1.c 查看时,在当前目录下产生了一个 .p1.c.swp 文件。

但是我使用ls命令查看该目录下,却发现没有这个文件,后来使用ls -a命令查看才知道 .p1.c.swp 是一个隐藏文件。

注:以.开头的文件就是隐藏文件哦。

当我把该隐藏文件删除后再次打开就没有上面的警告了。

root@iZ2zeeailqvwws5dcuivdbZ:~/1/01/指针# rm .p1.c.swp

root@iZ2zeeailqvwws5dcuivdbZ:~/1/01/指针# 

  

我的GitHub地址: https://github.com/heizemingjun
我的博客园地址: http://www.cnblogs.com/chenmingjun
我的蚂蚁笔记博客地址: http://blog.leanote.com/chenmingjun
Copyright ©2018 黑泽明军
【转载文章务必保留出处和署名,谢谢!】
相关文章
|
7月前
|
Linux C语言 网络架构
Linux的基础IO内容补充-FILE
而当我们将运行结果重定向到log.txt文件时,数据的刷新策略就变为了全缓冲,此时我们使用printf和fwrite函数打印的数据都打印到了C语言自带的缓冲区当中,之后当我们使用fork函数创建子进程时,由于进程间具有独立性,而之后当父进程或是子进程对要刷新缓冲区内容时,本质就是对父子进程共享的数据进行了修改,此时就需要对数据进行写时拷贝,至此缓冲区当中的数据就变成了两份,一份父进程的,一份子进程的,所以重定向到log.txt文件当中printf和fwrite函数打印的数据就有两份。此时我们就可以知道,
123 0
|
11月前
|
安全 Linux 数据安全/隐私保护
linux root登陆,密码正确但,错误提示su: Authentication failure
通过系统化的排查和解决方案,可以有效应对 `su: Authentication failure` 问题,确保系统安全和用户权限的正确管理。
6097 36
|
Java Unix Linux
Linux vi/vim
Linux vi/vim
142 5
|
Docker 容器
14 response from daemon: open \\.\pipe\docker_engine_linux: The system cannot find the file speci
14 response from daemon: open \\.\pipe\docker_engine_linux: The system cannot find the file speci
404 1
|
Oracle Java 关系型数据库
Linux下JDK环境的配置及 bash: /usr/local/java/bin/java: cannot execute binary file: exec format error问题的解决
如果遇到"exec format error"问题,文章建议先检查Linux操作系统是32位还是64位,并确保安装了与系统匹配的JDK版本。如果系统是64位的,但出现了错误,可能是因为下载了错误的JDK版本。文章提供了一个链接,指向Oracle官网上的JDK 17 Linux版本下载页面,并附有截图说明。
Linux下JDK环境的配置及 bash: /usr/local/java/bin/java: cannot execute binary file: exec format error问题的解决
|
机器学习/深度学习 存储 Linux
【机器学习 Azure Machine Learning】使用VS Code登录到Linux VM上 (Remote-SSH), 及可直接通过VS Code编辑VM中的文件
【机器学习 Azure Machine Learning】使用VS Code登录到Linux VM上 (Remote-SSH), 及可直接通过VS Code编辑VM中的文件
285 4
|
Ubuntu Linux
在Linux中,想修改ip,需要编辑哪个配置⽂件?修改完配置⽂件后,如何重启网卡?使配置生效?
在Linux中,想修改ip,需要编辑哪个配置⽂件?修改完配置⽂件后,如何重启网卡?使配置生效?
|
Linux
真香~ Linux vi常用命令汇总!
真香~ Linux vi常用命令汇总!
169 4
|
Oracle 关系型数据库 Linux
2022年最新编辑Linux基础知识总结
这篇文章是一份2022年的Linux基础知识总结,涵盖了Linux目录结构、远程操作、文本编辑、快捷键、系统管理命令、用户管理等方面的内容。
2022年最新编辑Linux基础知识总结
|
Linux
Linux中vi的常用命令和快捷键使用
Linux中vi的常用命令和快捷键使用
780 0