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

Similar Posts

Leave a Reply

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