2

I use gedit to modify/create files in my system, and sometimes I see that after editing, a duplicate file is created by the name of samename~

Just that ~ is extra. Why does this happen? Is there any significance of this file or is it okay if I delete it (I usually do)?

don_crissti
  • 79,330
  • 30
  • 216
  • 245

1 Answers1

7

Some editors backs up the original file with a suffix, usually ~ but sometimes .bak, when saving the new file.

Vim, for example, does this if the backup option is enabled. With Vim, you may also modify the suffix used for the backup files:

set backup
set backupext=.bak

See also :help backup in Vim.

Refer to the documentation for your particular text editor.

Kusalananda
  • 320,670
  • 36
  • 633
  • 936