Hostiso Blog

The latest news and announcements about our company, infrastructure and services!

How to remove cPanel users backups? - Hostiso - Advanced Hosting Solutions

  • June 15th, 2018

In this tutorial we will help you to clean up your server from old user backups. cPanel users can generate backups of their accounts. These backups are saved in the root of users’ directories, like /home/username/backup.tar.gz.

The filename format of the backups is backup-date_time_username.tar.gz. For example: backup-7.12.2018_19-32-49_hostiso.tar.gz The issue is that these backups take disk space and at some point you may see that your server is low on disk space. So, it’s a good idea to remove these backups from time to time.

We recommend to notify your clients that you are removing backups (older than 7 days etc.)

If you wish to remove backups for one cPanel account, just navigate to the user’s directory and remove them with the command:

rm /home/username/backup-*.tar.gz

Usage example:

root@web [/]#
root@web [/]# cd home/hostiso
root@web [/home/hostiso]# ls backup-*.tar.gz
backup-7.12.2018_19-32-49_hostiso.tar.gz  backup-7.12.2018_19-32-49_hostiso.tar.gz
root@web [/home/hostiso]# rm /home/hostiso/backup-*.tar.gz
rm: remove regular file '/home/hostiso/backup-6.11.2017_09-52-31_hostiso.tar.gz'? y
rm: remove regular file '/home/hostiso/backup-6.11.2017_09-52-35_hostiso.tar.gz'? y
root@web [/home/hostiso]#

To find and list all the backups from users’ directories:

find /home/* -maxdepth 1 -type f -name 'backup-*.tar.gz'

To find and delete all the backups from users’ directories:

find /home/* -maxdepth 1 -type f -name 'backup-*.tar.gz' -delete

To find and list all the backups from users’ directories which are older than 7 days:

find /home/* -maxdepth 1 -type f -mtime +7 -name 'backup-*.tar.gz'

To find and delete all the backups from users’ directories which are older than 7 days:

find /home/* -maxdepth 1 -type f -mtime +7 -name 'backup-*.tar.gz' -delete

You can create a con job for this task and automate all. 1.Enter the cron job editor:

crontab -e

2. Add the cron job (this job will run every day at 04:00 and will delete all backup archives older than 5 days)

* 4 * * * find /home/* -maxdepth 1 -type f -mtime +5 -name 'backup-*.tar.gz' -delete

3. Exit (with saving the changes) the cron job editor.

4. Check if the cron job was added successfully with the command (it will list all cron jobs):

crontab -l

That is all, we hope this will help you to save space and maintain your server easily.

Want regular updates?

Our engineers and developers are always posting interesting articles regarding the latest announcements and guides in the world of cloud hosting.

Subscribe via RSS

What Our Customers Say

We've helped hundreds of clients with custom server solutions, enabling them to operate much more efficient and secure than they ever did before.

Hostiso are polite guys with rich experience in linux and script support. They know how to run hosting biz and that is why they are concerned about their customers comfort.

Mark Miller
Health Company

Finally, after so many hosts for now I feel I have found hosting provider that I will stay for long with. The main reason of my satisfaction as a customer is their support.

Tom Smith
Video Streaming Company

Hostiso is comfortable to deal with for such a novice in hosting like me. They have polite staff who interact with customers in high professional manner.

Mia Fonda
SAAS Billing Solutions

Looking for a custom solution?

Our support can help you with the best custom made solutions on the market, no

matter whether you're a small business or large enterprise.

Get in touch