Author Topic: Tilde files  (Read 811 times)

0 Members and 1 Guest are viewing this topic.

Offline Keith

  • Sr. Member
  • ****
  • Posts: 369
  • Karma: 3
  • Gender: Male
  • Linux Novice
    • View Profile
    • Awards
Tilde files
« on: October 06, 2012, 09:59:33 pm »
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?

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 12492
  • Karma: 306
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: Tilde files
« Reply #1 on: October 06, 2012, 10:31:14 pm »
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 ;)



You can change this setting in gedit if you wish .. it's in the gedit preferences.
WARNING: You are logged into reality as 'root'

logging in as 'insane' is the only safe option.

Offline Keith

  • Sr. Member
  • ****
  • Posts: 369
  • Karma: 3
  • Gender: Male
  • Linux Novice
    • View Profile
    • Awards
Re: Tilde files
« Reply #2 on: October 06, 2012, 10:43:41 pm »
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.

Offline Tony Norton

  • Jr. Member
  • **
  • Posts: 78
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
Re: Tilde files
« Reply #3 on: October 07, 2012, 05:41:40 pm »
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

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 12492
  • Karma: 306
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: Tilde files
« Reply #4 on: October 08, 2012, 12:03:50 am »
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.
WARNING: You are logged into reality as 'root'

logging in as 'insane' is the only safe option.

Offline Keith

  • Sr. Member
  • ****
  • Posts: 369
  • Karma: 3
  • Gender: Male
  • Linux Novice
    • View Profile
    • Awards
Re: Tilde files
« Reply #5 on: October 10, 2012, 05:48:59 pm »
Thank you, gents - I learn something every day.  Sadly, I rarely remember it.

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal