Difference and correct usage for /tmp and /var/tmp

I haven't put much thought into this until now, but it seems odd that there is a /var/tmp and /tmp directories for most of the linux distros I routinely use (Ubuntu, Centos, Redhat).

Is there any semantic difference between the two, like when whoever designed the first file system layout, he or she thought "Not all tmp files are created equal!"

The only difference I've found for Centos is that /tmp routinely scrubs out files older than 240 hours while /var/tmp holds onto stale files for 720 hours.


The main difference between both, is that /tmp is wiped whenever the system reboots where as /var/tmp gets preserved across reboots.

You'll be able to find further information regarding linux standard directory structures at the following link : http://www.pathname.com/fhs/pub/fhs-2.3.html#VARTMPTEMPORARYFILESPRESERVEDBETWEE.


Historically, /tmp was an in-memory-only filesystem, meaning its contents were destroyed by a reboot. /var/tmp was in a real file system, meaning its contents could survive a reboot.