Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

On most FHS systems, there is a /tmp folder as well as a /var/tmp folder. What is the functional difference between the two?

share|improve this question
Here is a similar question on Server Fault: Difference and correct usage for /tmp and /var/tmp –  pabouk Nov 11 '13 at 7:13

3 Answers 3

up vote 40 down vote accepted

/tmp is meant as fast (possibly small) storage with a short TTL. Many systems clean /tmp very fast - on some systems it is even mounted as RAM-disk. /var/tmp is normally located on a physical disk, is larger and can hold temporary files for a longer time. Some systems also clean /var/tmp - but with a longer TTL.

Also note that /var/tmp might not be avaiable in the early boot-process, as /var and/or /var/tmp may be mountpoints. Thus it is a little bit comparable to the difference between /bin and /usr/bin. The first is available during early boot - the later after the system has mounted everything. So most boot-scripts will use /tmp and not /var/tmp for temporary files.

Another (upcoming) location on Linux for temporary files is /dev/shm.

share|improve this answer

/tmp may be, and sometimes is, cleaned on reboot. /var/tmp is preserved between reboots.

See the Wikipedia article on the FHS.

share|improve this answer

They have the same purpose and functionality. Every version of UNIX/Linux will handle these directories differently. Historically, before the advent of RAM/swap based filesystems, you had disk-less systems where the / and /usr filesystems would be read-only and /var (variable) would be read-write. The /tmp name would be a symbolic link to /var/tmp. Later, disk-less systems fell out of style, disk space became cheaper (to have larger root filesytems) and technology allowed for filesystems mounted from memory instead of disk. The /var/tmp directory fell out of style, but is still used by some programs.

These days, more security are set up by default on /tmp, like g+s,+t permissions, but not on /var/tmp. Additionally, /var/tmp is rarely mounted from RAM or swap.

share|improve this answer

Your Answer


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.