-1

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!

Hizqeel
  • 1,895
Sam
  • 1

1 Answers1

0

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.

If you're sure you don't need to restore any edits before the crash, you can delete them.

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

stevieb
  • 341