📅 2017-Nov-06 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ tmp, tmpreaper ⬩ 📚 Archive
The /tmp
directory in Linux is where temporary files and directories are created by applications. If you did not do anything special during installation, it will be a directory under the root directory partition and hence has the same filesystem as that of the root filesystem. If you specifically created a partition for /tmp
, then it might be of the tmpfs filesystem type.
If the root partition is running out of space, you might want to check how big tmp directory is:
$ cd /tmp
$ du --summarize .
On my Ubuntu, I find that tmp directory is cleaned up only at the time of system startup or reboot. The init scripts in /etc/rcS.d
check the TMPTIME
value set in /etc/default/rcS
. This value indicates which files and directories in the tmp directory are up for deletion.
You can change this TMPTIME value to your preference:
TMPTIME=0
, then everything inside the tmp directory is deleted at reboot.TMPTIME=1
, then only files and directories older than a day are deleted and so on.TMPTIME=-1
, then nothing is deleted.You will notice that the tmp directory is cleaned up only when you reboot the system. If you want a periodic cleanup of the tmp directory, then use the tmpreaper tool as described here.
Tried with: Ubuntu 14.04