How to Find Largest Top 10 Files in Linux

This post will guide you how to find the largest files and directories on your Linux system. How do I find or search top 10 largest or biggest files on a CentOS or RHEL or Ubuntu Linux operating system.

find largest top 10 fiels1

Find Largest Top 10 Files in a Directory


If you want to find the largest top 10 files in your given directory in Linux, and you can use one of the following commands:

$ sudo du -ha /directory | sort -nr | head -n 10

For example, you want to check top 10 largest files in the /etc directory in your current Linux system, just issuing the following command:

$ sudo du -ha /etc | sort -nr | head -n 10

Outputs:

devops@devops:~$ sudo du -ha /etc/ | sort -nr | head -n 10
912K /etc/brltty/Text
812K /etc/ssl
788K /etc/ssl/certs
700K /etc/brltty/Contraction/zh-tw.ctb
680K /etc/apache2
676K /etc/apparmor.d/cache/usr.bin.evince
584K /etc/ssh
568K /etc/apache2/mods-available
544K /etc/ssh/moduli
472K /etc/java-11-openjdk

Find Largest Top 10 Files in a Directory and its Subdirectories


If you want to find or check top 10 largest files in a given directory and its subdirectories in Linux system. and you can use one of the following commands:

$ sudo find /etc -type f -print0 | xargs -0 sudo du -h | sort -rh | head -n 10

Or

$ sudo find /etc -type f -exec du -Sh {} + | sort -rh | head -n 10

Outputs:

devops@devops:~$ sudo find /etc -type f -exec du -Sh {} + | sort -rh | head -n 10
700K /etc/brltty/Contraction/zh-tw.ctb
676K /etc/apparmor.d/cache/usr.bin.evince
544K /etc/ssh/moduli
392K /etc/brltty/Contraction/zh-tw-ucb.ctb
268K /etc/brltty/Contraction/ko.ctb
256K /etc/apparmor.d/cache/usr.lib.libreoffice.program.soffice.bin
232K /etc/java-11-openjdk/security/public_suffix_list.dat
204K /etc/ssl/certs/ca-certificates.crt
156K /etc/ssl/certs/java/cacerts
132K /etc/ImageMagick-6/mime.xml

devops@devops:~$ sudo find /etc -type f -print0 | xargs -0 sudo du -h | sort -rh | head -n 10
700K /etc/brltty/Contraction/zh-tw.ctb
676K /etc/apparmor.d/cache/usr.bin.evince
544K /etc/ssh/moduli
392K /etc/brltty/Contraction/zh-tw-ucb.ctb
268K /etc/brltty/Contraction/ko.ctb
256K /etc/apparmor.d/cache/usr.lib.libreoffice.program.soffice.bin
232K /etc/java-11-openjdk/security/public_suffix_list.dat
204K /etc/ssl/certs/ca-certificates.crt
156K /etc/ssl/certs/java/cacerts
132K /etc/ImageMagick-6/mime.xml

Conclusion


You should know that how to find the Largest Top 10 Files and Directories  with Du or Find commands On a Linux operating system.

You might also like:

Sidebar



back to top