I originally asked this question in the Ubuntu Forums, and I thought I understood it, but then I saw somebody use the same command in a different way, and now I'm not sure if I understand it anymore, so I'm humbly asking for your help again.

This is what my standard Pictures directory looks like:

-rw-rw-r-- 1 mason mason 1.3M Aug 12 21:35 Beijing-trip.jpg
-rw-r--r-- 1 mason mason  26K May 27  2013 Eiffel-tour.jpg
-rw-r--r-- 1 mason mason 1.5M Sep 20  2013 work-buddies.jpg
-rw-r--r-- 1 mason mason 155K Apr  2  2013 Q1-profits.jpg
-rw-r--r-- 1 mason mason 245K Nov 27  2016 Ireland.jpg
-rw-r--r-- 1 mason mason 675K Jun 14  2014 Christmas.jpg
-rw-r--r-- 1 mason mason 210K Nov 27  2016 Thanksgiving.jpg
-rw-r--r-- 1 mason mason 348K May 27  2013 family.jpg
-rw-r--r-- 1 mason mason 805K Feb 27  2015 museum-of-fine-arts.jpg
-rw-r--r-- 1 mason mason 8.6K May 26  2013 4th-of-July.jpg
-rw-r--r-- 1 mason mason  20K Mar  9  2013 Taipei.jpg
-rw-r--r-- 1 mason mason 1.9M Jun 14  2014 Australia.jpg
-rw-r--r-- 1 mason mason 404K Aug 10 21:53 business-trip.jpg
drwxrwxr-x 2 mason mason 4.0K Mar 18 16:55 Wallpapers
-rw-r--r-- 1 mason mason 145K Jan 15  2015 family-reunion.jpg
-rw-r--r-- 1 mason mason 6.7K Apr  2  2013 friends-and-family.jpg

According to the man page for the find command, when using the -size test, file sizes get rounded up before getting processed by the find command, but what I'd like to know is by how much?

Specifically, how come find . -size -1M returns nothing, whereas find . -size -8k prints file friends-and-family.jpg as well as directory Wallpapers? Maybe I've always misunderstood this, but in the Ubuntu Forums I first learned that the reason file friends-and-family.jpg doesn't show up in the output after typing find . -size -1M was because the file gets rounded up to 1MB, and since we specifically asked for files that are less than 1MB, the find command doesn't print the name of the file. But if file friends-and-family.jpg gets rounded up to 1MB in the first iteration of the command, how come file friends-and-family.jpg ends up in the output when typing find . -size -8k? Shouldn't the file friends-and-family.jpg get rounded up again to 1MB? If so, then how come a file with a 1MB size shows up in the output when we specifically asked for files less than 8KB?

In addition to the above questions, I also need to know up to what value do the files above get rounded up to when typing the following commands:

find . -size -2M
find . -size -3M
find . -size -8k
find . -size -10k
find . -size -2G

Your help is greatly appreciated.

  • There's no "first iteration" - the file size is only rounded internally by the find command, not actually changed on disk Aug 15, 2017 at 0:21
  • Oh, I know that. I know the files aren't modified. The reason I wanted to know up to what value the files get rounded up to internally, is because I want to know why certain files appear in the output and why others don't. Aug 15, 2017 at 0:23

1 Answer 1


This is explained in the manpage (emphasis mine):

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 1 to 1,048,575 bytes.

Note: next unit. With -1M, a file of size 6.7k (~0.007M) gets rounded up to 1M, because the unit in consideration is MB. Similarly, with -8k, the size gets rounded up to 7k, since the current unit is KB, and that is well within the limits.

So, for these commands:

find . -size -2M
find . -size -3M
find . -size -8k
find . -size -10k
find . -size -2G

A size of 6.7k will get rounded up to 1M, 1M, 7k, 7k, 1G respectively.

Now, going back to the quoted paragraph, do you see why -size -1x for any unit x will always only match empty files?

  • Ohhh, OK, I see. As soon as a file contains 1 byte of data, it would get rounded up to 1GB when typing find . -size -1G. And since a file that appears as a 1GB file can't be less than 1GB, find doesn't return anything, only empty files. Thanks muru. Aug 15, 2017 at 0:32
  • 1
    Oh, one more question. If I type find . -size -10k and have two files, one with a size of 26KB and another with a size of 1.3MB, what do those files get rounded up to? My guess is that the 26KB file stays the same, whereas the 1.3MB file gets rounded up to 2.0MB, but I want to be sure. Aug 15, 2017 at 3:07
  • @John_Patrick_Mason ~1300KB
    – muru
    Aug 15, 2017 at 3:34
  • Oh, so you're saying that if the file sizes falls outside of the bound, the find command doesn't even bother to round them up? Aug 15, 2017 at 3:39
  • 1
    @Number945 I'm saying that the number "1.3MB" doesn't hold enough meaningful information in it for representing it precisely in KB.
    – muru
    Jan 31, 2021 at 14:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .