1. 程式人生 > >MAC修改host檔案報錯

MAC修改host檔案報錯

MAC修改hosts檔案需要在前面加sudo 管理員許可權;

sudo vi /etc/hosts

然後輸入電腦密碼;

但是有一天他突然報了下面這一噸東西;看不懂

應該說什麼存在了

E325: ATTENTION

Found a swap file by the name "/etc/.hosts.swp"
          owned by: root   dated: Sat May 27 16:48:39 2017
         file name: /private/etc/hosts
          modified: YES
         user name: root   host name: CJW.local
        process ID: 56194
While opening file "/etc/hosts"
             dated: Tue Jun  6 18:04:36 2017
      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 /etc/hosts"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file "/etc/.hosts.swp"
    to avoid this message.


Swap file "/etc/.hosts.swp" already exists!

[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)born:

然後我cd /etc

到這個目錄下,輸入  ls

沒有發現有他寫的這個檔案

然後 ls -a

出現了  .hosts.swp 

在終端  rm .hosts.swp

一切迴歸正常;