The -size
flag for GNU find
behaves strangely. Let's say I have the following three files in a directory:
$ lh
total 8.7M
-rw------- 1 wvoq wvoq 42K 2012-05-24 18:25 small
-rw------- 1 wvoq wvoq 7.3K 2012-05-24 18:37 tiny
-rw------- 1 wvoq wvoq 8.7M 2012-05-24 18:37 big
Two of the files are less than 1MB, and the other is about 9MB. Which of the files are less than 50K in size?
$ find -type f -size -50k
small
tiny
Which is what we expect. But which are less than 1MB in size?
$ find -type f -size -1M
$
Necessarily, any file less than 50k is also less than 1M, so why the discrepancy? Even more disturbingly, we have:
$ find -type f -size -2M
small
tiny
which would seem to suggest that small
and tiny
are between 1 and 2 MB in size, when in fact they are both <50k. What's happening here?