Description of problem: find -size -1M and find -size -1k do not work Version-Release number of selected component (if applicable): findutils-4.2.27-5.el5.x86_64 Steps to Reproduce: # for i in 10 20 30 \ 100 200 300 \ 1000 2000 3000 \ 10000 20000 30000 \ 100000 200000 300000 \ 1000000 2000000 3000000 do dd if=/dev/zero of=$i bs=1 count=$i done # ls -lgG total 6656 -rw-r--r-- 1 10 Oct 10 07:14 10 -rw-r--r-- 1 100 Oct 10 07:14 100 -rw-r--r-- 1 1000 Oct 10 07:14 1000 -rw-r--r-- 1 10000 Oct 10 07:14 10000 -rw-r--r-- 1 100000 Oct 10 07:14 100000 -rw-r--r-- 1 1000000 Oct 10 07:15 1000000 -rw-r--r-- 1 20 Oct 10 07:32 20 -rw-r--r-- 1 200 Oct 10 07:14 200 -rw-r--r-- 1 2000 Oct 10 07:14 2000 -rw-r--r-- 1 20000 Oct 10 07:14 20000 -rw-r--r-- 1 200000 Oct 10 07:14 200000 -rw-r--r-- 1 2000000 Oct 10 07:15 2000000 -rw-r--r-- 1 30 Oct 10 07:32 30 -rw-r--r-- 1 300 Oct 10 07:14 300 -rw-r--r-- 1 3000 Oct 10 07:14 3000 -rw-r--r-- 1 30000 Oct 10 07:14 30000 -rw-r--r-- 1 300000 Oct 10 07:14 300000 -rw-r--r-- 1 3000000 Oct 10 07:15 3000000 # find -size -1k -- nothing -- # find -size -1024c ./10 ./100 ./1000 ./20 ./200 ./30 ./300 # find -size -1M -- nothing -- # find -size -1048576c . ./10 ./100 ./1000 ./10000 ./100000 ./1000000 ./20 ./200 ./2000 ./20000 ./200000 ./30 ./300 ./3000 ./30000 ./300000
Wrong usage. Command should be "find -size 1k" (or "1M"). # dd if=/dev/zero of=0 bs=1 count=0 # dd if=/dev/zero of=1 bs=1 count=1 # find -size -1k ./0 Read man page carefully and see bz246122 (same problem reported in the past) for more explanation.
Ok, I see the "logic" of units, but this is not very intuitive behaviour, which is confirmed by the fact that more and more people run into this issue: http://lists.gnu.org/archive/html/bug-findutils/2005-02/msg00014.html http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=489905 http://savannah.gnu.org/bugs/?12162 I think this should be fixed by providing an alternative modifier for size parameter (not to break backward compatibility) as has already been suggested in the gnu bug report: http://savannah.gnu.org/bugs/?12162#comment2 The best solution (although not ideal) could probably be to use ++ and -- find -size --1M find -size ++1k This should be well documented in find's man page which is now quite brief about the size parameter comparing to following find documentation: http://www.gnu.org/software/findutils/manual/html_mono/find.html.gz#Size
Closing UPSTREAM (http://savannah.gnu.org/bugs/?12162), there's no reason to duplicate it here.