這是經典的 vi/vim 的報錯情形,
在 Linux 下,使用 vim 或是 vi 查看檔案時,可能每次都會出現下面貼出的 E325 錯誤提醒,然后按 E 進行 Edit anyway 才能繼續讀寫檔案,
這個 vim/vi 的報錯提醒,如果不處理,每次編輯文本都會出現,很添麻煩,
下面,直接介紹一下解決辦法:
E325: ATTENTION Found a swap file by the name ".tmp.log.swp" owned by: cctv dated: Sat Nov 23 14:57:00 2019 file name: ~/tmp.log modified: YES user name: cctv host name: centos-T process ID: 29468 While opening file "tmp.log" dated: Sat Nov 23 22:24:17 2019 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 tmp.log" to recover the changes (see ":help recovery"). If you did this already, delete the swap file ".tmp.log.swp" to avoid this message. Swap file ".tmp.log.swp" already exists! [O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:
解決辦法
在報錯檔案的同一路徑下,執行此 Bash 命令來顯示出該檔案夾下的所有隱藏檔案:
ls -la
在 Linux 下,隱藏檔案的檔案名第一個字符,都是一個小句點,
然后,找到并洗掉與你的報錯檔案同名的 swp 檔案即可,
如你的錯誤檔案的檔案名是 tmp.log,那么,對應的 vi 快取隱藏檔案,檔案名應該是 .tmp.log.swp,沒錯,刪掉它就好,
rm -y .tmp.log.swp
執行這條 rm 命令時,記得檔案名改為你的檔案名對應的 swp 檔案,很簡單,前面加 . 后面加 .swp ,只洗掉 swp 檔案就好,不要誤刪了你的原檔案檔案,
這樣基本就搞定啦,測驗一下,再使用 vi/vim 編輯你的檔案,應該就再沒有 Edit anyway / Abort 的 E325 提醒了,
附:
一般對應的 swp 檔案,都在你的報錯檔案的同一路徑下,如果沒有,說明同一路徑下 vi/vim 沒有創建檔案的資格,它會把 swp 檔案創建在其他地方,
那么細讀 E325 報錯時的螢屏資訊,應該能找到對應的 swp 檔案路徑,找到后,去刪了即可,
如果本篇文章幫助了你,請在文章末尾給我點一個推薦,感謝!
以上,
風尾留,
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/151683.html
標籤:Linux
上一篇:Linux系統學習 十七、VSFTP服務—本地用戶訪問—用戶訪問控制
下一篇:centos7安裝tomcat
