I have a question concerning the
find
command in Linux.
In all the articles I've found online it says that attribute -size -10M
, for example, returns files that are less than 10 MB in size. But when I tried to test this, it seems that -size -10M
returns files that are less than or equal 9 MB in size.
If I do
find . -type f -size -1M
the find
command returns only empty files (the unit is irrelevant, it can be -1G, -1k...).
find . -type f -size -2M
returns files Bear in mind that the size is rounded up to the next unit. Therefore -size -1M is not equivalent to -size -1048576c. The former only matches empty files, the latter matches files from 0 to 1,048,575 bytes.
Ok, so I guess -1M is rounded to 0M, -2M to -1M and so on... ?
But then
find . -type f -size 1M
returns files 1M and <= 2M, etc.
Is this all normal or am I doing something wrong and what's the exact behavior of the -size
parameter?
Asked by golder3
(1194 rep)
Mar 9, 2021, 10:05 AM
Last activity: Apr 17, 2024, 08:05 AM
Last activity: Apr 17, 2024, 08:05 AM