Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux Command , how to find files by size larger than x?

Tags:

linux

shell

I'm trying to find files with size larger than "x" , ex: 32 bytes

But what I found in ls --help was only ls -S , that just sort by size and not satisfied my demand

I'm new to Linux , I've tried Google but I don't know what keywords should I use to find answer , could somebody give me advice , thank you !

like image 522
DumDumGenius Avatar asked Oct 29 '25 08:10

DumDumGenius


2 Answers

Try to use the power of find utility.

Find files greater than 32 bytes:

find -size +32c

Of course you could also ask for files smaller than 32 bytes:

find -size -32c

And files with exact 32 bytes:

find -size 32c

For files with 32 bytes or more:

find -size 32c -o -size +32c

Or not smaller than 32 bytes (the same as above, but written another way):

find ! -size -32c

And files between 32 and 64 bytes:

find -size +32c -size -64c

And you can also apply other common suffixes:

find -size +32k -size -64M
like image 98
rslemos Avatar answered Oct 31 '25 00:10

rslemos


Try this:

find . -size +32c -ls

You can change 32 for the size you want. In this case, I used your example.

like image 28
Ludwig Avatar answered Oct 31 '25 00:10

Ludwig



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!