Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to do a unix find based on size of files, including in subdirectories?

Trying to use osx find to find all the files in my directory tree. I googled and SO'd and looked at man but none helped.

So far I have: find -f -c1mb which is clearly wrong.

like image 801
Michael Durrant Avatar asked Mar 06 '12 03:03

Michael Durrant


4 Answers

find . -size +20000

The above one should work.

like image 151
Teja Avatar answered Nov 13 '22 15:11

Teja


I guess you want to find files bigger than 1 Mb, then do

$ find . -size +1M
like image 44
Diego Torres Milano Avatar answered Nov 13 '22 14:11

Diego Torres Milano


On Ubuntu, this works:

find . -type f -size +10k

The above would find all files in the current directory and below, being at least 10k.

like image 4
icyrock.com Avatar answered Nov 13 '22 13:11

icyrock.com


This command tell you "the size" too :-)

find . -size +1000k -exec du -h {} \;
like image 1
MCurbelo Avatar answered Nov 13 '22 14:11

MCurbelo