2

This question already has an answer here:

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)?

marked as duplicate by Jeff Schaller, don_crissti, Stephen Rauch, G-Man, Hunter.S.Thompson Nov 18 '17 at 11:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    It's not sometimes... It's either always or never, based on your settings (Preferences > File Saving > Create a backup copy of files before saving) – don_crissti Nov 17 '17 at 13:34
  • @don_crissti May be sometimes user11327 does not look. – ctrl-alt-delor Nov 17 '17 at 15:08
8

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.

  • 2
    Old school local machine version control. And it has saved me several times over the decades – ivanivan Nov 17 '17 at 13:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.