How can I make ls (or any other command) list only files bigger than a specific file size?
Asked
Active
Viewed 2.1e+01k times
4 Answers
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
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.