So in noticed every time I edit a text file with gedit, i get a hidden file in this directory with the same name except in the end this file has this symbol ~

So why does the system or gedit creates such files and can I safely delete them.

Interesting thing is that even after i delete the main file this files do not get deleted.


These files are backups. Gedit creates them in case you make a mistake when editing a file, so you can restore it afterwards. So if you're sure that you don't want to revert those changes, you can safely delete those files ending in "~".

This behavior can be changed if you want to. For this, open Gedit, go to EditPreferencesEditor and toggle the option "Create a backup copy of files before saving."

  • They will be removed when you save: you can ignore them. They are also used if the editor/system dies. – ctrl-alt-delor Feb 20 '15 at 0:14
  • Actually, they are being created when you save. – s3lph Feb 20 '15 at 21:42

Gedit has an option under the Editor tab in the preferences which will create a backup copy of a file before saving which is checked by default in Ubuntu and can be disabled to remove this functionality. Also it is generally safe to delete these files as they are only backups of the originals, obviously the only un-safe time to delete them would be if you lost the original but assuming you still have them then it is safe.

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