KNOWNHOST WIKI

User Tools

Site Tools


control-panels:cpanel-whm:how-to-manage-trash-in-cpanel

How To Manage Trash in cPanel

There are two locations that you will want to concern yourself with in regards to trash.

First, there is the email trash, located at

  /home/user/mail/domain.tld/account/.Trash

and then there is the File Manager trash, located at

  /home/user/.trash

The mail trash can fill up easily as it must be configured to be removed in WHM, and cPanel users will not have this access on shared machines. The system administrator should be aware of the settings that we will discuss so that they can properly manage the server's disk space usage.

To prevent the email trash folders from becoming too large in the future (as these are not automatically cleared by default), you can browse to "WHM Home » Service Configuration » Mailserver Configuration" and enable the "Auto Expunge Trash" option. Choose how long you want deleted email to remain on the server if you want to automatically empty the trash folders.

File Manager trash (trash resulting from deleting files via File Manager) are stored in /home/user/.trash. You can use the "Empty Trash" option in File Manager to remove them, or delete them manually through SSH or FTP. Also, there is the 'Age of content to purge from users' File Manager Trash' setting in the System section of WHM's Tweak Settings interface (Home » Server Configuration » Tweak Settings). This determines the minimum age of files before the system to automatically purges them from the .trash folders in user home directories. A value of 0 configures the server to purge all files from every user's .trash folder, regardless of age.

If your disk space usage shown in cPanel is not updated in real time, you may be able to browse to cPanel → Files → Disk Space Usage, locate the drop-down box on that page, and click Clear File Usage Cache to force cPanel to update the current disk space consumption (depending on your cPanel version).

Note that removing trash will also lower cPanel's "Other Usage" as trash content adds to the 'other' disk usage for that user.

Below are some useful commands for working with trash directories via SSH.

To find the disk space consumed by all user's email trash directories on the server:

  du -Hhsc /home/*/mail/*/*/.Trash

To find the disk space consumed by all user's File Manager trash directories on the server:

  du -Hhsc /home/*/.trash

To clear all user's email trash directories:

  rm -rf /home/*/mail/*/*/.Trash/*

To clear all user's File Manager trash directories:

  rm -rf /home/*/.trash/*

To see the disk space consumption for a single user's email trash, where user's username is USER:

  du -Hhsc /home/USER/mail/*/*/.Trash/

To see the disk space consumption for a single email account's trash, where the email account is info@domain.com:

  du -Hhsc /home/USER/mail/domain.com/info/.Trash/

To see the disk space consumption for a single user's File Manager trash, where user's username is USER:

  du -Hhsc /home/USER/.trash

If you have any trouble, please open a support ticket and we'll be glad to help! :)

control-panels/cpanel-whm/how-to-manage-trash-in-cpanel.txt · Last modified: 2020/06/10 14:39 by Karson N.