[sf-lug] My favorite simple little Linux tips

Mike Higashi mhigashi at gmail.com
Thu Aug 5 11:36:28 PDT 2010

On Wed, Aug 4, 2010 at 11:57 PM, Rick Moen <rick at linuxmafia.com> wrote:
> Biggest files within an entire _tree_:
> find . -xdev -type f -print0 | xargs  ls -l | sort -rn -k 5 | head -20

That's a real nice demonstration of the use of find. I use it a lot,
but often don't go beyond the switches I'm already familiar with,
so I learned something new here.

> (People often answer with shell expressions that list the largest
> files and _directories_, but that's a different and easier problem.)

As you say, my usual inclination would be to do something like:

find . -type f -size +100M -ls


find . -type f -size +100M -exec du -h {} \;

With either of these two the results are not sorted by size, and it's
up to you to pick a reasonable minimum size to search for, to
keep the number of files in the result set at a reasonable level.


More information about the sf-lug mailing list