🧹 Complete cPanel Disk Cleanup Guide
If your server disk space fills up quickly, removing unnecessary files is essential.On cPanel-based servers, log files, backups, and temporary data can consume a large amount of space.
In this guide, you’ll find practical and effective terminal commands for performing cPanel disk cleanup step by step.
⚠️ IMPORTANT: Always take a full backup of your important files before proceeding.
Once deleted, some files cannot be recovered.
🛠️ Useful Commands for Disk Cleanup and Explanations
Step 1: Remove Apache Backup Files
Old Apache backup files can occupy significant space.Use the following command to delete them:
Bash:
rm -rf /usr/local/apache.backup*
Step 2: Clear cPanel Temporary and Restore Files
cPanel temporary user files and leftover restore data can pile up:
Bash:
rm -fv /home*/*/tmp/Cpanel_*
rm -rvf /home*/cpanelpkgrestore.TMP*
Step 3: Delete Softaculous Backup Files
Softaculous backup folders often contain old backups taking large amounts of space.You can clean them using these commands:
Bash:
rm -fv /home*/*/.softaculous/backups/*
rm -fv /home*/*/softaculous_backups/*
Step 4: Remove Log Archives
Compressed and archived log files (tar.gz, zip, gz) can safely be removed:
Bash:
rm -f /var/log/*.gz
Step 5: Remove Extra User Backups and Logs
User directories often contain old backups and large error_log files:
Bash:
rm /home*/*/*.tar.gz -fv
rm /home*/*/public_html/*.tar.gz -fv
rm /home*/*/public_html/error_log -fv
Step 6: Delete Trash and ZIP Files
Clearing user trash and zip archives can free up a significant amount of space:
Bash:
rm -rfv /home*/*/public_html/*.zip
rm -rfv /home*/*/*.zip
rm -rf /home*/*/.trash/*
Step 8: Clean Up WordPress Backup Files
WordPress backup plugins such as AI1WM (All-in-One WP Migration) and Updraft can store large files.You can safely remove these with:
Bash:
rm -rfv /home*/*/*/wp-content/ai1wm-backups/*
rm -rfv /home*/*/*/wp-content/updraft/*
By using these commands, you can reclaim valuable disk space on your cPanel server by removing unnecessary logs, backups, and temporary files.
After cleaning up, your server will perform more efficiently and be easier to manage.