0

Example:

I create a.tar.gz from the file "a.txt" (so I used the -z option). Let's say the checksum of the file a.txt before it's added to the archive is "abc123".

When I untar and "a.txt" is written to disk, can I make it so tar checks that the checksum of a.txt on the destination disk is "abc123" and fail if it isn't the same?

0

I don't think that tar has this ability built in however you could run

md5sum -c a.txt

After you've untar'd it.

Example:

$ md5sum file > a.txt
$ tar -czvf a.tgz /etc/hosts
$ tar -xzvf a.tgz
$ md5sum -c a.txt 
file: OK

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.