md5 hash only first 512 bytes of file
You can use dd
to pipe only the first 512 bytes to md5sum
. However this will cause md5sum
to be oblivious of the filename, so in addition replace -
with the filename again.
find . -type f -exec sh -c "dd if={} bs=512 count=1 2>/dev/null | md5sum | sed s\|-\|{}\|" \; | sort -k 34;