36

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?

0

2 Answers 2

35

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.

1
  • Just noting that if the folderset is shared via Samba and then a Windows client's Office software edits a file it will create a hidden file locking metaphor using ~$OriginalFilename.xlsx, for example. It will contain the necessary information about who has the lock. So be careful writing scripts to do clean-up work if this is your scenario. Aug 17, 2015 at 18:52
12

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~

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .