Clean Up /tmp Directory in Server Manually (cPanel)

2
Updated on 8 March 2022

Over time, the temporary directory in cPanel server can grow big, even bigger than the size of your MySQL databases. It can be worse if you keep changing CMS. They will create more temporary files and make that /tmp folder big. I usually have this problem in my development server.

I consulted my hosting provider on how to clean up /tmp directory manually and safely.

They said that it is okay to delete all files inside /tmp directory except the folders and its contents.

For example

Deleting the whole /tmp folder is NOT okay

Deleting the /tmp/sess_123456789123456789 file is okay

Deleting the /tmp/awstats/ folder is NOT okay

Deleting the /tmp/awstats/ssl/ folder is NOT okay

Deleting the /tmp/awstats/awstats.example.com.conf file is NOT okay

I have done that since 2014 every time I feel the /tmp folder is already too big. Nothing goes wrong so far.

I hope it can help confirming what is okay to do when cleaning up /tmp folder manually.

2
First published by  on Last Modified on 8 March 2022.

2 Comments

Add new comment
  • Thank you very much. I was just looking this information and search 50 posts in google. Finally I found the best advice. Could you please tell me is it okay to delete cache and cache.out file inside the ANALOG folder of TMP FOLDER. MY 2 files are huge around 100mb in size. Thanks in advance.

    • I’m glad it can help you.

      Just to confirm: the file is /TMP/ANALOG/cache.out?

      If it is so, I wouldn’t delete those 2 files as it is against the guidelines from my hosting provider (i.e. don’t delete folders and those folders’ contents inside /tmp).

Add A Comment

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