Linux - Difference between /tmp and /var/tmp

November 2016


The /tmp and /var/tmp directories are both used to store temporary files, but their use is slightly different.

The differences

  • When a program writes temporary files in /tmp, don't expect to find it at the launch of another program..
  • Indeed this directory can be cleaned out anytime. In the vast majority of distributions, this directory is cleaned at each reboot.

However, the files written to /var/tmp will be kept after restart.

Thanks to sebsauvage for this tip.

Related :

This document entitled « Linux - Difference between /tmp and /var/tmp » from CCM ( is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.