124

How can I make ls (or any other command) list only files bigger than a specific file size?

Johnny
  • 1,367

4 Answers4

200

Use find and its -size flag.

To find files larger than 100MB:

find . -type f -size +100M

If you want the current dir only:

find . -maxdepth 1 -type f -size +100M
Drew Noakes
  • 2,317
Nifle
  • 34,998
42

If you wish to see all files over 100M and to see where they are and what is their size try this:

find . -type f -size +100M -exec ls -lh {} \;
Ofir Zvik
  • 421
4

Use the following:

find / -size gt 2MB

or:

find / -size => 2000000 
0

In SunOS, the size is specified in blocks (512 bytes per block) by default. So, for files larger than 100MB, the example will be:

find . -size +200000

The M, m (for mega) or K, k (for kilo) are not accepted.

It is possible to specify a size in bytes. To do that, a c can be used following the size number as follows:

find . -size +100000000c

And, again, M, m, K, or k modifiers are not accepted.

Note: the previously mentioned -file and -exec options work as expected in SunOS.