.swp文件会影响实际文件吗?

问题描述

我正在使用以下命令vi /etc/iptables/rules.v4文件编辑文件,并且我的终端崩溃了。 当我再次尝试编辑同一文件时,收到以下消息


       E325: ATTENTION
    Found a swap file by the name "/etc/iptables/rules.v4.swp"
              .
    .
    .
    .
    
    (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/iptables/rules.v4"
        to recover the changes (see ":help recovery").
        If you did this already,delete the swap file "/etc/iptables/rules.v4"
        to avoid this message.
    
    Swap file "/etc/iptables/rules.v4.swp" already exists!
    [O]pen Read-Only,(E)dit anyway,(R)ecover,(D)elete it,(Q)uit,(A)bort:

我的问题是,这会影响我原来的rules.v4文件吗? 在停止处理文件之后 我对linux完全陌生

解决方法

swap文件是vim生成的临时文件,用于跟踪您在崩溃时所做的更改。如果文件rules.v4正常,则可以将其删除。否则,我强烈建议您将其恢复,保存并删除.swp文件。请注意,只要您不保存,“恢复”选项就不会写入规则中。v4