日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

【linux】使用swap文件恢复非正常关闭的文件

發布時間:2023/12/18 linux 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【linux】使用swap文件恢复非正常关闭的文件 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

前言

使用vim的時候,文件編輯過程中可能會出現bug,導致非正常關閉。為了保存剛剛修改的內容,需要對文件進行恢復。

操作過程

1.查看目錄文件

zrj@zrj-ThinkPad-E470:~/work/code/facedetection/src$ ll total 48 drwxrwxr-x 2 xxx xxx 4096 Sep 11 16:48 ./ drwxrwxr-x 6 xxx xxx 4096 Sep 11 12:23 ../ -rw-rw-r-- 1 xxx xxx 10859 Sep 11 16:48 facedet.cpp -rw-r--r-- 1 xxx xxx 20480 Sep 11 16:43 .facedet.cpp.swp -rw-rw-r-- 1 xxx xxx 6346 Sep 11 16:44 facedet_test.cpp

發現多了個swap文件。

2.問題描述

E325: ATTENTION Found a swap file by the name ".facedet.cpp.swp"owned by: xxx dated: Tue Sep 11 16:59:21 2018file name: ~xxx/work/code/facedetection/src/facedet.cppmodified: nouser name: xxx host name: xxx-ThinkPad-E470process ID: 22229 (still running) While opening file "facedet.cpp"dated: Tue Sep 11 16:55:31 2018(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 facedet.cpp"to recover the changes (see ":help recovery").If you did this already, delete the swap file ".facedet.cpp.swp"to avoid this message.Swap file ".facedet.cpp.swp" already exists! [O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort:

3.原因分析

a.文件非正常關閉;

b.另一個Terminal也在編輯同一個文件;

?

4解決方法

a.非正常關閉;

使用recover覆蓋文件,再刪除swap文件;

1. vim -r facedet.cpp 2. rm .facedet.cpp.swp

b.同時編輯同一個文件;

先關閉一個文件再編輯另一個,注意避免同時編輯同一個文件;

注意,修改文件時請注意避免同一個文件產生兩個不同的版本。

參考

1.csdn博客;

轉載于:https://www.cnblogs.com/happyamyhope/p/9628904.html

創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

總結

以上是生活随笔為你收集整理的【linux】使用swap文件恢复非正常关闭的文件的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。