Disk Usage Useful Command

Note - You can replace /home with correct '/' drive on your server

1. Checking the disk usage - du -sch *

2. Checking the disk usage of hidden files - du -shc .??* *

3. Find error logs more than 250 MB on server -  find /home -name "error_log*" -size +250M -exec ls -hl {} \;

4. Find Backups more than 100 MB on server - /home -name "*backup" -size +100M -exec ls -lh {} \;

5. Find zip files on server - find -name "*.zip" | awk '{system ("du -sh "$1)}' ;

6.Find tar files on server -  find -name "*.tar" | awk '{system ("du -sh "$1)}' ;

7. Find tar.gz files on server - find -name "*.tar.gz" | awk '{system ("du -sh "$1)}' ;

8. Find zip and tar files on server - cd /home; ll | grep zip; ll | grep tar; 

9. Remove stuff from trash 2 days and older -  find /home/*/.trash/ -ctime +2 -type f -exec rm -fv {} \; 

10. Removing backups -

rm -rf */backup-*; 
rm -rf */application_backups; 
rm -rf */softaculous_backups;

11. Removing Error log - rm -f */public_html/error_log ;

12. Removing stderr.log - rm -f /usr/local/apache/logs/stderr.log.*

Was this answer helpful?

 Print this Article

Also Read

How to install phpMyAdmin with Apache on a CentOS 7 server?

phpMyAdmin used to provide graphical user interface for your databases. Accessing or performing...

How to install Imagic?

1. # yum install ImageM* netpbm gd gd-* libjpeg libexif gcc coreutils make 2.  # cd...

How to backup and restore large MySQL databases using mysqldump?

1. Backup database: #mysqldump -u username -p[username_password] databasename >...

How to install SOAP on CentOS?

Install SOAP on CentOS 1) Fire below command - yum install php-soap Output will be as follow...

How to setup the email alert for low disk space?

If you don't want to setup to a full monitoring solution such as Nagios you can create your own...

Powered by WHMCompleteSolution