Linux: find largest files in File System

When a filesystem is nearly full you need to find files which may cause this.

Use this command to find the largest files ( top 10 ) within a particular file system :

find <filesystem> -mount -printf ‘%s %p\n’ 2>/dev/null | sort -nr | head -10

example :

# df -hP /var/log
Filesystem                             Size  Used Avail Use% Mounted on
/dev/mapper/vg_lekkereappelflap-lv_varlog  4.7G  310M  4.2G   7% /var/log

# find /var/log -mount -printf ‘%s %p\n’ 2>/dev/null | sort -nr | head -10
61396041 /var/log/messages
49654251 /var/log/sssd/sssd.log
26871761 /var/log/messages.1
24712921 /var/log/sssd/sssd.1.log
12921684 /var/log/logfile11.log
12342975 /var/log/logfile12.log
7998696 /var/log/logfile44.log
4663828 /var/log/XXX/file96.log
4652859 /var/log/XXX/file103.log
4637448 /var/log/XXX/file 999.log

Leave a comment

Your email address will not be published.


*


Fix this before you comment on this post * Time limit is exhausted. Please reload the CAPTCHA.