In the Linux command line, how can I find all files exactly 158 kB in size? I was using the following command but it didn't work:
find /var/www/ -xdev -type f -size 158k
In the Linux command line, how can I find all files exactly 158 kB in size? I was using the following command but it didn't work:
find /var/www/ -xdev -type f -size 158k
Find files of exact size
[me@localhost ~]$ dd if=/dev/zero bs=1024 count=158 of=/dev/shm/158k.txt
158+0 records in
158+0 records out
161792 bytes (162 kB) copied, 0.00120192 s, 135 MB/s
[me@localhost ~]$ find /dev/shm -type f -size 158k
/dev/shm/158k.txt
Your file that was not found is not likely 158 KB. To validate its size, use /bin/ls -al /path/to/file
and stat /path/to/file