Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

In Windows, I believe that files with a tilde in the file name represent files that are currently open in an application. For example, Microsoft Word creates a file with almost the same name as the file you currently have open, but with a tilde in the name. It's icon is also partially faded. As far as I'm aware, this signifies a temporary file that exists

  • in case the application crashes and you didn't get a chance to save your file, or
  • to allow the original file to remain unlocked by the file system and accessible to other applications.

In Linux, I ran into a *.log file with a tilde at the end of the file name (scan.log~). Does that mean the log file is currently open in another application that is potentially writing to it?

share|improve this question
1  
It doesn't necessarily mean anything about the present usage of the file. The default text editor (aka gedit) creates them, but seems to leave them lying around forever, even when you close the file. –  8128 Aug 7 '12 at 21:01

2 Answers 2

up vote 9 down vote accepted

If a file is appended with a tilde~, it only means that it is a backup created by a text editor or similar program; it does not suggest another program is writing to that file. Besides, any file opened in vi cannot be opened in another application, but that is another discussion.

To easily find all these type of files, type cd to get to the top level of your home folder and enter:

find -type f -iname '*~'

Or, if you want to find them in a specific directory, type:

find /home/mike/Downloads -type f -iname '*~'

These files can be very useful if you happened to have edited a file and have not saved a backup of the original! Gedit, for example, creates such a backup of any file edited, although you can turn off this setting in the preferences. However, the (files~) are no substitute for a proper backup, as they might not contain the data you need, or be the version of the edit you wanted.

share|improve this answer
    
Does this answer confuse files beginning with a '.' (hidden), and those beginning with a '~'? The latter aren't hidden. –  John S Gruber Aug 8 '12 at 1:59
    
No, I know the differences, but I'll edit it to make it clearer. –  user76204 Aug 8 '12 at 8:39
    
I have edited my answer, which was correct in the beginning, but now I have removed any confusing references and explained it better. –  user76204 Aug 8 '12 at 9:04

Some text editors (such as emacs) create a backup of the file you are editing, and give the backup file the name of the original file plus a tilde. The file you describe might be the result of opening scan.log with such a text editor and making some change.

You can use fuser (see Ubuntu package psmisc) to see if a process currently has that file open: fuser scan.log~

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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