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 perform LAMP installation on CentOS?

LAMP stands for Linux, Apache, MySQL, and PHP. It is nothing but Linux operating system with...

Basic exim commands

1. REMOVE MAILS BY ID - /usr/sbin/exim -v -Mrm (MAIL ID HERE) 2. LIST QUEUED MAILS -...

Daily Useful Linux Commands

Finding the username from provided hosting service name - /script/whoowns domain_name Finding...

How to backup and restore large MySQL databases using mysqldump?

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

How to change the port number of Apache Web Server?

Default port to access the Apache is 80. Secure port for communicating with world for Apache is...