Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm always hesitant to use /var/tmp/, because I never quite know exactly how long the files are kept there for, or even what the directory is used for. What determines when a file gets removed from /var/tmp/, and how is the directory intended to be used?

share|improve this question

migrated from Jul 27 '10 at 2:49

This question came from our site for professional and enthusiast programmers.


Per the Filesystem hierarchy standard (FHS), files in /var/tmp are to be preserved across reboots.

Per FHS-2.3:

The /var/tmp directory is made available for programs that require temporary files or directories that are preserved between system reboots. Therefore, data stored in /var/tmp is more persistent than data in /tmp.

Files and directories located in /var/tmp must not be deleted when the system is booted. Although data stored in /var/tmp is typically deleted in a site-specific manner, it is recommended that deletions occur at a less frequent interval than /tmp.

I'm not aware of any Linux distributions that automatically clean /var/tmp. IMO, the applications that use /var/www cleanup after themselves in some reasonable manner.

share|improve this answer
So by default, files in /var/tmp are not deleted automatically and are only deleted when the user manually deletes them? – thebackhand Jul 26 '10 at 23:26
I don't think that's a given as it says it's "deleted in a site-specific manner," implying that you don't have any guarantees other than it won't be deleted across a reboot. But, I think it's likely that most distributions won't delete the files in that directory but will rely on the application to clean them up. – Kaleb Pederson Jul 26 '10 at 23:44

All RHEL-based distros clean /var/tmp of files older than 30 days. I don't know about other distros. Look for a cron entry that invokes tmpwatch. On Fedora/RHEL it is /etc/cron.daily/tmpwatch. It has a line like /usr/sbin/tmpwatch "$flags" 30d /var/tmp or /usr/sbin/tmpwatch 720 /var/tmp. 720 hours = 30 days.

share|improve this answer
To be more specific, they delete files that have not been accessed, modified or had a status change in the last 30d. – Didier A. Sep 30 '15 at 2:17

Your Answer


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