# How to delete the duplicate file with extension “~”

I have an issue opening one of the config file, each time when I try to edit it by giving sudo vi XX file name XX it says:

"Swap file ".config.ini.swp" already exists! [O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:"

Then I see that there is another config file in my dir with same with extension "filename.ini~"

Can anyone please let me know on how to take the back up for in file and delete it the duplicate one.

Thanks much!

• Possible duplicate of Unable to delete file – Panther May 17 '16 at 16:36
• recover and save the file first. – Panther May 17 '16 at 16:36
• vim tends to create .swp files as backup. Just rm .config. ini. swp file , and reopen .config. ini fil and you will be ok. As for filename. ini~ those are backup by nano editor if I'm not mistaken – Sergiy Kolodyazhnyy May 17 '16 at 16:52

The tilde filename.ext~ are vi/vim backup files. They are a copy of a file you've edited as it was before you opened it in vim.
The .swp files are swap files, and they act as locks, preventing you from editing the file in another instance of vim. These files stick around if your vim instance crashes while editing.
For the tilde files, if you want to restore from them, just do mv config.ini~ config.ini. If you want to delete them (all) within your current working directory: find . -name "*~" | xargs rm