Skip to content

tail

"tail - output the last part of files" - man tail (GNU version)

Examples

Hash the last 1mb of a file

Some files have bulk data stored at the end, with metadata at the beginning. If that metadata has changed, it is difficult to detect when the bulk data is duplicate. tail can help with this. The following command will tail the last 1048576 bytes of a file and hash them. This syntax works the same on macOS and linux.

for FILE in * ; do
  echo "$(tail -c 1M "$FILE" | sha256sum) $FILE"
done | sort