On most FHS systems, there is a /tmp
folder as well as a /var/tmp
folder. What is the functional difference between the two?
Directory Structure FHS – Difference Between /tmp and /var/tmp
directory-structurefhstmp
directory-structurefhstmp
On most FHS systems, there is a /tmp
folder as well as a /var/tmp
folder. What is the functional difference between the two?
Best Answer
/tmp
is meant as fast (possibly small) storage with a short lifetime. 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 less often.Also note that
/var/tmp
might not be available 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 latter 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
.