Open e.g. a mail attachment from Firefox (without previously saving it); this is a Libre Office document, you edit it, and then push save (not save as) and close both text editor and browser. Then the document disappears, as it was stored by default in /tmp. At least this is the case on my Ubuntu 12.04.

Do you think this is the correct behavior? Shouldn't the program at least remind you that you're not really saving anything? or is there some way to recover the file (also after logout and/or reboot)?


Playing around with this I find that when you choose to open a document with an external program in Firefox, what happens is that Firefox downloads the program to /tmp and then runs the chosen program with the downloaded file as an argument (read 'opens the file with the chosen program').

If you then save the file (without choosing Save As or the equivalent) from within the program, it will use this file in /tmp.

Firefox will clean up these temporary files when it closes. So you can recover the file if you close LibreOffice, but not Firefox. However, as soon as Firefox is closed, the file will be deleted.

On most (all?) distros, the /tmp folder will also be emptied on reboot (files in /var/tmp should persist for longer).

Note also that this behaviour is only for 'opening' a file with an external program. If the file is opened internally via a plugin or otherwise, then it appears /tmp is not used (the file appears to be cached elsewhere along with the web pages themselves).


For reference (I don't recommend doing this unless it is necessary), you can disable the deleting of /tmp on files when firefox closes using the browser.helperApps.deleteTempFileOnExit option. This can be set via the about:config page (just type this in the address bar and press enter). If it exists and is false, just right click on it and choose toggle. Otherwise, add it by doing Right Click->New->Boolean, then enter the name of the option and choose false.

To store /tmp files past the next reboot on recent Debian based systems, first look at /etc/default/tmpfs and make sure the is no RAMTMP=yes line. If it is commented out (# at the start), this is fine (if it was set then /tmp would be on a tmpfs filesystem in memory and would not be stored on disk). Next add or change the TMPTIME line in /etc/default/rcS. To store /tmp files indefinitely you can do:


Or you can use a positive number instead of infinite to keep them for that number of days, once their time is up they will be deleted at the next reboot. Obviously if this line is commented out, uncomment it.

  • Note that the fact that /tmp is cleared on reboot is because /tmp is mounted as a tmpfs, which stores its files in RAM (or swap), thus losing its contents after unmounting it. – Darkhogg Mar 30 '14 at 20:24
  • 1
    @Darkhogg, not the case. /tmp files are usually specifically cleared. I have updated with how the settings for this can be changed on Debian based systems. – Graeme Mar 30 '14 at 20:31
  • Didn't know about that! +1 to that comment. – Darkhogg Mar 30 '14 at 20:33
  • 1
    @glglgl pathname.com/fhs/2.2/fhs-3.15.html – Graeme Mar 30 '14 at 21:42
  • 1
    When a file is opened in Firefox via a plugin, the plugin can specify how it wants the file delivered: on disk, or directly to memory. Most plugins choose memory. – Mark Mar 30 '14 at 21:50

Firefox has a cache for "opening" files. This cache is cleared up each time you close Firefox. If you open that file with LO, and close Firefox you will notice that the file will disappear. This is true for all Firefox independently they are stored in /tmp or not.


Do you think this is the correct behavior?

I have to say that I don't think it is. But then I'm a bit biased, having nearly lost six hours of work due to this quirk.

I think that any GUI that lets the user do something potentially disastrous without warning them is flawed, no matter how "logical" the design decision behind it might be. This especially so when users can do exactly the same thing in similar programs (like Chrome) with no ill effects.

Shouldn't the program at least remind you that you're not really saving anything?

Hmmm... maybe a pop-up with a checkbox saying "Don't show this message again" would be useful. Even more useful would be a small fix to LibreOffice and similar programs warning the user if the file they're saving is being saved in /tmp or wherever. I mean, if you press "save", you expect the file to be saved somewhere, right?

or is there some way to recover the file (also after logout and/or reboot)?

Yes, if you're lucky. I booted my computer up from a usb linux installation and managed to recover the file using extundelete.


Let me explain. When you choose "Open with" as opposed to "Download to" in the dialog, the file is still downloaded, at which point Firefox opens the downloaded file with the application. However, the assumption is that you did not want to keep the file, so it this file is deleted when firefox exits. If you had wanted to keep it you should be chosen "Download to", or used "Save as" in your application, or simply moved the file out of /var/tmp (where filefox keeps it); the deletion only applies to the file in its original location.

Note that the file is deleted even if the other application keeps it open (in the technical sense). On Unix-like systems this isn't a problem: while the directory entry goes away, the file itself remains and won't be deleted until the application closes it [a crash at this point may leave the disk at an inconsistent state; fsck reports this situation as an "unlinked inode"]


Do you think this is the correct behavior?

Of course it is the right behavior. It only happens when you didn't choose to save the file but instead chose to open it. In my opinion, it's usually better to save everything instead of opening.

Shouldn't the program at least remind you that you're not really saving anything?

Why? If you wanted to save, why didn't you choose to download the file?

or is there some way to recover the file (also after logout and/or reboot)?

Nope. You would have to copy it when it's still in tmp.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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