How to find top K largest files in a directory on Linux?

I have many files in a directory on Linux. How to find top K largest files in a directory?

For example, find top 10 (K=10) large files in the current directory:

du -h --max-depth 1 * | sort -rh | head -n 10

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

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