Finding the largest files in Linux filesystems

Using du

du -ax /my/dir | sort -nr | head -10

The above command is simple and will often be enough for finding large files. However, du always lists directories so it can't be used to strictly list only files. To truly get the top 10 largest files, use the find command.

Using find

find /my/dir -xdev -type f -printf '%s %p\n' | sort -nr | head -10

The above command while more complex and less portable, actually does returns a list of the top 10 largest files.


Disclaimer

Ideas may still be sprouting

Notes in my digital garden are written primarily for my own reference and understanding. They may be unfinished, unorganized, outdated, and/or incorrect.