bashtar

How to use Pigz with Tar


So I am using pigz in tar with

tar --use-compress-program=pigz

and this works but it doesn't use all of my processors, and I'd like to make sure it's recursive (-r) and using (-9 compression level).

I read through Utilizing multi core for tar+gzip/bzip compression/decompression but it doesn't note anywhere to add additional commands in that format, and I couldn't find anything in the man page for either program for additional swithed.

Thanks, Cam


Solution

  • Mark Adler's top voted answer on the SO link that you included in your question does provide a solution for specifying compression-level as well as number of processors to use:

    tar cf - paths-to-archive | pigz -9 -p 32 > archive.tar.gz
    

    See : https://stackoverflow.com/a/12320421