Clean tmp folder in Linux

On Linux servers, you may face disk space or inode limit reaching on /tmp partition due to large number of temporary files. Most of the time it will be PHP sesion files. To clean these files, you can use a cronjob like the following. It have some common extension i found on shared cpanel server, files in your sever may be differnt. You need to investigate what is taking up disk space on your /tmp folder and modify the script as needed.

Create file

Add following

-mtime +30 is to find files that are modified 30 or more days ago.

Make it executable

Create a cronjon

Add

See tmp

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *