How to find the biggest files in filesystem – Linux, UNIX, HP-UX

Disk space issues are the most common problems raise in the day-to-day life of Linux system admin. So in this article, you can find out the commands to find out the largest files in your file system which are causing problems for the filesystem.

Find for Large Files under Specific Mountpoint

find /var -xdev -type f -size +500000c -exec ll {} ; | sort -nk 5
find /home -xdev -type f -size +5000000c -exec ll {} ; | sort -nk 5
find /opt -xdev -type f -size +5000000c -exec ll {} ; | sort -nk 5
find /usr -xdev -type f -size +5000000c -exec ll {} ; | sort -nk 5
find /tmp -xdev -type f -size +50000000c -exec ll {} ; | sort -nk 5
find /var -xdev -type f -size +50000000c -exec ll {} ; | sort -nk 5

For Solaris & Linux, replace ‘ll’ with ‘ls -l’

find / -xdev -type f -size +50000000c -exec ls -l {} ; | sort -nk 5
find /usr -xdev -type f -size +50000000c -exec ls -ld {} ; | sort -nk 5
find /var -xdev -type f -size +50000000c -exec ls -ld {} ; | sort -nk 5
find / -xdev -type f -size +50000000c -exec ls -ld {} ; | sort -nk 5
find /nfs/tmp -xdev -type f -size +5000000c -exec ls -ld {} ; | sort -nk 5
find /data -xdev -type f -size +50000000c -exec ls -ld {} ; | sort -nk 5
find /usr1/data1 -xdev -type f -size +50000000c -exec ls -ld {} ; | sort -nk 5
find /apps -xdev -type f -size +50000000c -exec ls -ld {} ; | sort -nk 5
find /nfsdata -xdev -type f -size +50000000c -exec ls -l {} ; | sort -nk 5
find /see_data -xdev -type f -size +50000000c -exec ls -l {} ; | sort -nk 5

HP-UX

bdf /var

Solaris, Linux, and AIX

df -k /var

Where -k report size in KB

df -h /var

-h report size in GB / Human-readable

df -h /var

size in GB (Solaris 9++)

Leave a Reply

Your email address will not be published. Required fields are marked *