find /etc -size -1G return only empty files

Chris Adams cmadams at hiwaay.net
Fri Mar 26 04:10:36 UTC 2010


Once upon a time, Rick Stevens <ricks at nerd.com> said:
> As it stands,
> you'd need to use "-1099511627776c" to get the inferred behavior and
> that's a right pain.

Well, for most cases, for what you are wanting from -1G, you could use
-1024M.  If you want to be precise though (and are lazy and don't want
to fire up a calculator), use the shell to do your math, so
-$((1024*1024*1024))c.

Since the standard says the -size option works on block sizes and rounds
up to the next whole block size, I don't think you'd get GNU find to
change (even though the k, M, and G suffixes are non-standard
extensions).  You're best bet would be to implement a new option like
-bytes or some such.

-- 
Chris Adams <cmadams at hiwaay.net>
Systems and Network Administrator - HiWAAY Internet Services
I don't speak for anybody but myself - that's enough trouble.


More information about the users mailing list