In Centos, I have a text file in my home directory.
The command find . -size -1M
doesn't show my file but find . -size -1000k
does show it. This problem just seems to be happening when I use the number "1". The first command will work if I use -2M
even though the file is only 500k in size.
Am I doing something wrong?
Best Answer
find . -size -1M
will only show file of size less than 1M, that is 0M. Yes, I know, it's confusing.find . -size 1M
will show you files whose size (rounded up to the upper MiB) is 1M (so any file size from 1 to 1048576). If you want from 0 to 1048575 (< 1M), that would be:If you want from 0 to 1048576 (<= 1M)
or