Tilde files

Before modifying an Ubuntu system file recently (mimeapps.list), I saved a backup copy first. Upon bravely using my new-found Unix skills to remove the backup once everything was working, I found another copy of the original (and hence backup) file with the “~” symbol appended (mimeapps.list~).
Can anyone explain the reason for its presence, before I delete it?

You probably have gedit set to save a backup copy of changed files before saving … in which case gedit saves a file called original_filename~ as a backup.

Point is I had no way of knowing if you had gedit set to do this, so erred on the side of caution … better to have two backups than none :wink:


You can change this setting in gedit if you wish … it’s in the gedit preferences.

Ah, yes - it was my first use of gedit and you are right.
I think I’ll leave it like that as I can screw up anything!
My thanks, as usual.

Don’t know if this is relevant to Unix, but in Windows a tilde, usually precedes the filename in Windows, is an indicator that the file is open and stops another user on the terminal or network from altering the file. If you have a program crash the tilde file will remain on the system and needs to be deleted before you can further modify the original file.

Tony N

Yeh, some applications in Linux do something similar … take LibreOffice for example, if you open a file called mydoc.odt it will create a hidden lock file in the same directory called .~lock.mydoc.odt# (where the “.” at the beginning makes it a hidden file) … to stop it being edited by others.

Meanwhile if any changes are made to the document, and you have Autorecovery enabled, a backup will be created at ~/.config/libreoffice/3/user/backup/Untitled 1.odt_0.odt … the number in red will count up in increments every time it is autosaved.

LibreOffice also supports versioning.

As in Windows … only certain apps do this


But the files Keith was referring to were backups made by gedit … where it creates a backup with a tilde suffix when you save a file … it’s a backup, not a lock or even a recovery, as it doesn’t lock the file and if the machine went down before you saved changes, the backup wouldn’t be created.

Thank you, gents - I learn something every day. Sadly, I rarely remember it.