How does /tmp directory get emptied automatically over time ?
Introduction In order to maintain overall operating system stability it is important to check that directories/file systems being used as temporary storage space by applications should get full. This is because a temporary file system out of space could cause a server to go into hung state and under extreme circumstances even a kernel panic might occur. Have you ever wondered why most files inside the /tmp directory get deleted over some time if they are left unused? If you have then this article is for you. In this article we will explain how and why the /tmp directory gets emptied over a period of time on Linux systems. We will explaining the concept on Centos 6/RHEL 6 systems. The mechanism is different in case of Centos 7/RHEL 7 systems. A program named tmpwatch is responsible for periodically cleaning up the /tmp and /var/tmp directories on Centos 6/RHEL 6 systems. tmpwatch recursively removes files which haven’t been accessed for a given time. Normally, it’s used to clean up directories which are used for temporary holding space such as /tmp. It does not follow symbolic links in the directories when it’s cleaning up the directory, will not switch file systems, skips lost+found and directories owned by the root user. The tmpwatch program should be installed on the system by default and you confirm the same by performing a query on...
Read More