当前位置:网站首页>vim 出现 Another program may be editing the same file. If this is the case 的解决方法
vim 出现 Another program may be editing the same file. If this is the case 的解决方法
2022-07-04 12:32:00 【码农研究僧】
问题所示
通过vim或者vi编辑文件的时候出现如下所示:
终端显示如下:
Found a swap file by the name "/mydata/mysql/conf/.my.conf.swp"
owned by: root dated: Sat Jul 02 12:52:53 2022
file name: /mydata/mysql/conf/my.conf
modified: YES
user name: root host name: xx
process ID: xx
While opening file "/mydata/mysql/conf/my.conf"
CANNOT BE FOUND
(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 /mydata/mysql/conf/my.conf"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file "/mydata/mysql/conf/.my.conf.swp"
to avoid this message.
Swap file "/mydata/mysql/conf/.my.conf.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:
截图如下:
2. 原理分析
在linux中系统为了保证安全性,如果文件遭到不一
比如多人编辑这个文件导致文件的不一、上次编辑没有正常退出等
会将其文件后缀生成一个swp格式的文件(临时交换文件,主要备份缓冲区内容)
保存或者写入文件的方式无误,一般swp格式文件都会自动删除,如果写入有误,临时文件就会一直存在,再次编辑的时候就会一直指到改文件
将其删除重新编辑或者恢复重新编辑即可
3. 解决方法
通过ls -al查看全部文件的时候
可以看到swp格式(隐藏临时文件,临时缓冲区)
vim编辑出现的提示:
根据如下提示对应解决
如果文件不重要,直接q退出,rm -rf删除重新再来即可
边栏推荐
- Serialization oriented - pickle library, JSON Library
- How to judge the advantages and disadvantages of low code products in the market?
- (August 9, 2021) example exercise of air quality index calculation (I)
- Games101 Lesson 8 shading 2 Notes
- The database connection code determines whether the account password is correct, but the correct account password always jumps to the failure page with wrong account password
- Day01 preliminary packet capture
- QQ get group link, QR code
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 8
- Alibaba cloud server connection intranet operation
- Reptile learning 3 (winter vacation learning)
猜你喜欢
Attributes and methods in math library
MySQL advanced review
Force buckle 142 Circular linked list II
2021 annual summary - it seems that I have done everything except studying hard
netstat
Enter the smart Park, and change begins here
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 19
Summary of Shanghai Jiaotong University postgraduate entrance examination module firewall technology
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 10
os. Path built-in module
随机推荐
[the way of programmer training] - 2 Perfect number calculation
Reptile learning 4 winter vacation learning series (1)
Reptile learning 4 winter vacation series (3)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 10
Unity performance optimization reading notes - Introduction (1)
How to use "bottom logic" to see the cards in the world?
In 2022, financial products are not guaranteed?
(August 9, 2021) example exercise of air quality index calculation (I)
Attributes and methods in math library
IO stream ----- open
2021 annual summary - it seems that I have done everything except studying hard
OSI seven layer model & unit
QQ group collection
Pat 1059 prime factors (25 points) prime table
Summary of Shanghai Jiaotong University postgraduate entrance examination module -- cryptography
Guava ImmutableSet. Builder source code analysis, shift original code, complement code, reverse code review
. Does net 4 have a built-in JSON serializer / deserializer- Does . NET 4 have a built-in JSON serializer/deserializer?
Awk getting started to proficient series - awk quick start
Data communication and network: ch13 Ethernet
DVC use case (VI): Data Registry