I just stumbled in an oddity with the find command on Linux, in a nutshell I had the need to find all files smaller than 2Kb in a certain folder, so I issued the command:
find /folder_to_search_into/ -type f -size -2k
which according to the man page of find should return everything smaller than 2Kilobytes
But what I noticed is that it missed a number of files, which were between 1 and 2Kb in size.
I then issued
find /folder_to_search_into/ -type f -size -2048c
which should be the exact equivalent since "c" stands for bytes, and in this case it found all the files I was looking for.
Any idea as of why this behavior? I'm probably missing the obvious here. Not sure if it's related to this note (from the find man page -- in the size section):
The size does not count indirect blocks, but it does count blocks in sparse files that are not actually allocated. Bear in mind that the '%k' and '%b' format specifiers of -printf handle sparse files differently. The 'b' suffix always denotes 512-byte blocks and never 1 Kilobyte blocks, which is different to the behavior of -ls.