How to clear /tmp on CentOS/cPanel server

If your /tmp is too small, then you will face /tmp full issue. cPanel by default create /tmp with 512mb space. For shared hosting server 512mb is too small.

If you face /tmp full issue, you can clear your tmp using tmpwatch. Also you can remove session file.

First wee need to install tmpwatch.

yum install tmpwatch -y

once tmpwatch is installed run following command-

/usr/sbin/tmpwatch --mtime --all 24 /tmp

This will delete all files over 24 hours old. We can configure cronjob to automated this process.

from SSH type:

crontab -e

Go to the very bottom and paste

cron

then press Control+X you will get confirmation do you want to save. Type Y for yes, and press enter.

Also we can delete session file using following command.

# cd /tmp
# rm -rf sess_*

  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

How to fix defaultwebpage.cgi on a webserver

Running the following commands solves the above problem:   /scripts/updateuserdomains...

How to fix IP Missing issue on cPanel/WHM

We are here to help you with solving the problem of Missing IP Server in list accounts. The...

Install Let's Encrypt SSL in cPanel/WHM

Let's Encrypt, a valid, open-source license that offers free SSL for your domains. The Let's...

Fix Email Issue on a server using the MSFE

To solve the problem of not sending/receiving email on a server using the MSFE / Mailscanner...

Domain names are not showing in WHM

We were unable to see any domains listed under WHM -> List Accounts. However, we can see the...