[CentOS] "find" switch to find files of a certain size?

Carl Boberg Carl.Boberg at nrm.se
Mon Jan 14 15:59:37 UTC 2008


> On Mon, 2008-01-14 at 09:56 -0500, William L. Maltby wrote:
> > On Mon, 2008-01-14 at 08:21 +0100, Andreas Kuntzagk wrote:
> > > Am Sonntag, den 13.01.2008, 10:16 +0700 schrieb Fajar Priyanto:
> > > > On Thursday 10 January 2008 23:21:55 
> techlists at comcast.net wrote:
> > > > > Is there a switch in "find" (or some other command 
> besides find) 
> > > > >that'll  let you find files larger than a specified size?
> > > > ><snip>
> 
> > May I suggest (g)awk? That way you'll get all, not just 20, of what 
> > you want.
> > 
> >     du -s *|sort -rn|gawk --re-interval '/^[[:digit:]]{4,}\t/' -
> > 
> > This shows dirs with block counts of 1000 or more. And then 
> there is 
> > perl etc. Usually these threads get long as everyone jumps in with 
> > their personal favorite, including me here. :-)
> > 
> > And smaller dirs can be identified with
> > 
> >     du -s *|sort -rn|gawk --re-interval '/^[[:digit:]]{,3}\t/' -
> > 
> > BTW, I was surprised that the 4.* implementation defaults 
> required the 
> > "--re-interval" switch. Hmmm.
> 
> BTW, sort can be eliminated if order is unimportant.

Why not just use find to test for a file size since thats what he asked
for in the first place :)

find ./ -size +5M

Finds all files recursively from the dir you are standing in with a size
of 5 MB or more.
 -size n[cwbkMG] File uses n units of space
Numeric arguments can be specified as
+n     for greater than n,
-n     for less than n,
n      for exactly n.

/ C



More information about the CentOS mailing list