Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Pigz with Tar

Tags:

bash

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

like image 462
Cam Avatar asked Apr 28 '16 14:04

Cam


People also ask

How to compress with Pigz?

How to Compress Files with Pigz. To compress a single file to a zip format use the syntax. However, the command deletes the original file upon compression as you might have noticed. To retain the original file after compression, run use the -k option as shown.


1 Answers

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

like image 114
Amit.Sinha Avatar answered Nov 11 '22 17:11

Amit.Sinha