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.