Reference
https://serverfault.com/questions/377348/when-does-tmp-get-cleared
That depends on your distribution. On some system, it’s deleted only when booted, others have cronjobs running deleting items older than n hours.
- On Ubuntu 14: using
tmpreaperwhich gets called by/etc/cron.daily, configured via/etc/default/rcSand/etc/tmpreaper.conf. (Credits to this answer). - On Ubuntu 16: using
tmpfiles.d. (Credits to this answer). - On other Debian-like systems: on boot (the rules are defined in
/etc/default/rcS). - On RedHat-like systems: by age (RHEL6 it was
/etc/cron.daily/tmpwatch; RHEL7/RHEL8 and RedHat-like with systemd it’s configured in/usr/lib/tmpfiles.d/tmp.conf, called bysystemd-tmpfiles-clean.service). - On Gentoo
/etc/conf.d/bootmisc.