Monitor /tmp usage on Linux

Just a quick post to show how to monitor usage of /tmp on a Linux system. Setup a cron job as follows…

* * * * * df -h | grep "/tmp" >> /tmp/tmp.log

This job will run every one minute logging details of /tmp usage to a file called tmp.log. To report on this later you can run the following command to get a unique ordered list.

cat /tmp/tmp.log | sort | uniq
/dev/sda3              60G  344M   58G   1% /tmp
/dev/sda3              60G  348M   58G   1% /tmp
/dev/sda3              60G  351M   58G   1% /tmp
/dev/sda3              60G  354M   58G   1% /tmp
/dev/sda3              60G  357M   58G   1% /tmp
/dev/sda3              60G  359M   58G   1% /tmp
/dev/sda3              60G  360M   58G   1% /tmp
/dev/sda3              60G  361M   58G   1% /tmp
/dev/sda3              60G  364M   58G   1% /tmp
/dev/sda3              60G  4.1G   54G   8% /tmp
/dev/sda3              60G  4.2G   54G   8% /tmp
/dev/sda3              60G  4.3G   54G   8% /tmp

Leave a Reply

Current day month ye@r *