I observe that when I use PIGZ version, generated tar file's md5sum hash is different than the next one generated.

Instead of PIGZ=-n if I use GZIP=-n generated hashes are same. I have followed following answer for Tar produces different files each time.

$ find sourceCode -print0 | LC_ALL=C sort -z | PIGZ=-n tar \
--mode=a+rwX --owner=0  --group=0 --absolute-names --no-recursion --null -T - -zcvf file.tar.gz
$ md5sum file.tar.gz # some hash is generated

# When I apply the same operation above output for md5sum file.tar.gz is different

=> Is this a normal case? or is it possible to have same behavior for PIGZ like GZIP?


1 Answer 1


If you want tar to use pigz, you need to ask it to do so:

... | PIGZ=-n tar -Ipigz --mode=a+rwX --owner=0  --group=0 --absolute-names --no-recursion --null -T - -cvf file.tar.gz

With the -Ipigz option, and without -z, tar uses pigz and the PIGZ variable is taken into account. This results in tarballs with the same contents as gzip-compressed archives with GZIP=-n.

  • Also is it neccesary for me to use --mode=a+rwX --owner=0 --group=0 --absolute-names parametes in addition to your answer on tar produces different files each time.
    – alper
    Apr 17, 2020 at 13:25
  • 1
    That’s a somewhat different question; the answer depends on what variability you want to allow. You need to set the owner/group if you want to allow different users to build your tarball and still produce the same tarball. Apr 17, 2020 at 13:34
  • When I add a character and remove a character from the file I am tarring, even the data's hash is same, its zipped hash differs. I am not sure what may be the real cause of it or is it a normal behavior. Please see as a new question: unix.stackexchange.com/questions/630736/…
    – alper
    Jan 24, 2021 at 14:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .