I was editing a file using the following command vi /etc/iptables/rules.v4
file and my terminal crashed.
When I again tried to edit the same file I got the following message
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:
My question is will this affect my original rules.v4 file? As after this is stopped working on the file I am completely new to linux
swap file is a temporary file that is generated by vim to keep track of changes you have made in case of a crash. If the file rules.v4 is ok, you can delete it. Otherwise I strongly recommand to recover it, save it, and remove the .swp file. note that as long as you don't save, the Recover option will not write in the rules.v4