1

Does the OS (CentOS) clear the temporary files automatically and what is the difference between /tmp and /var/tmp ?

If the system clears these files automatically, how can I change the TTL ?

1

They are different:

/tmp is mounted since boot and cleaned between reboots.

/var/tmp could be unavailable during boot if /var is a mountpoint. It is not cleaned between reboots.

CentOS 6 has an utility called tmpwatch. It is being executed daily (at the time cron.daily is invoked) from the script called /etc/cron.daily/tmpwatch. It deletes a file if the atime (last accessed time) is more than 10 days ago.

In CentOS 7 it is different because it uses systemd-tmpfiles-clean.timer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.