Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
28
Help us understand the problem. What is going on with this article?
@elu_jaune

Viで「E325:ATTENTIONエラー」の対処

More than 1 year has passed since last update.

はじめに

viでファイルを編集中にうっかりCtrl+Cコマンドで中断してしまったため、多重オープンしてしまった。対処方法をまとめた。

事象

vi で対象ファイルを開いたら次のようなメッセージが毎回出てしまう

--------------------------------------------- 
E325: ATTENTION 
Found a swap file by the name ".attention.sh.swp" 
 owned by: yasushisatou dated: Tue Jan 01 00:01:00 2019 
 file name: /tmp/attention.sh 
 modified: YES 
 user name: root    host name: localhost.localdomain 
 process ID: 9999 
While opening file "attention.sh" 
 dated: Tue Jan 01 00:01:00 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 atention.sh" 
 to recover the changes (see ":help recovery"). 
 If you did this already, delete the swap file ".atention.sh.swp" 
 to avoid this message. 
"attention.sh" 540L, 627C 
Press ENTER or type command to continue 
--------------------------------------------- 

対処

  1. オープンしようとしているファイルのパスに移動
  2. ls -laコマンドで該当スワップファイルを確認
drwxr-xr-x. 6 root   root   4096 Jan 01 00:01 .
drwxr-xr-x. 6 root   root   4096 Jan 01 00:01 ..
-rw-r--r--. 1 root   root  12288 Jan 01 00:01 .attention.sh.swo *
-rw-r--r--. 1 root   root  12288 Jan 01 00:01 .attention.sh.swp *
-rwxr-xr-x. 1 root   root   1383 Jan 01 00:01 .attention.sh

※マークのファイルがスワップファイル

  1. rmコマンドでスワップファイルを削除
28
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
elu_jaune
Windows Server メインの雑食おじさん。 詳しい業務経歴はLinked Inに掲載。

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
28
Help us understand the problem. What is going on with this article?