-1

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.

Levan
  • 10,880

2 Answers2

2

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."

s3lph
  • 14,314
  • 11
  • 59
  • 82
1

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.

Michael Lindman
  • 1,742
  • 2
  • 17
  • 23