Cleaning Up Your /tmp

Cleaning Up Your /tmp…The Safe Way


find /tmp -type f -name sess_* | xargs rm -f

Cron Job to Delete files in /tmp directory

First create the script and test it.

Here is a sample script that you would then need to modify:


find /tmp -type f -name sess_* | xargs rm -f #remove all sess_* files

ssh to the server

sh /etc/

Then save the script as for example. The do the following:

crontab -e

This will allow you to add cron jobs. Here is the format of each line in the file:
min hr day month day of week command

Therefore, if you want it to run on the 6 hours, add a line like this for example:

* */6 * * sh /etc/