I have two *.tar
files with similar contents. I want to verify which files are the same. A lot of the files are big so I comparing hashes would require extracting every file from each tar and computing the hash. Is there a way to hash files in a tar without having to extract it? Is there another way to compare files across two *.tar
files?
How to Hash Files in a Tar Archive
tar
Best Answer
If it's GNU tar, run this:
where file-stats-from-tar is somewhere in
$PATH
and is:Change
md5sum
if you need to.This does it all in a single pass.
How it works is that the
--to-command
option tells tar to send each file separately to the command you specify, with a bunch of environment variables set (we only useTAR_FILENAME
here).