Pigz: File Compression Tool work Over Multiple Processors and Cores

Pigz: File Compression Tool work Over Multiple Processors and CoresWhen you use the file compression tool, widely known as “gzip” for compressing files in the GNU/Linux platform and have a powerful multi-core and multithreaded CPU unit, then just like me (though my CPU unit ain’t that powerful), you too could be frustrated by the fact that “gzip” only uses a single CPU core when running.

Because, if it used all the available CPU power while running (compressing files that is), then it should speed up the process quite significantly. But, it does not do that. there’s a tool called “pigz” which basically is the multithreaded version of the “gzip” utility.

So, if you have a multicore CPU unit, and need to compress files as fast as possible (again, by using all of your CPU cores) then “pigz” will come in handy.

Main fearures of pgzip

  • Automatically detect your CPU cores and threads and will adjusts itself, so at the end, all of your CPU cores will be taken part of the compressing process.
  • However, if you don’t like to use all the available CPU cores (say for maintaining a stable system), then you can tell “pigz” to only use a certain number of processes instead.
  • According to its manual page, it’s the “almost compatible” version of “gzip”. So all the commands used in “gzip” should be usable in “pigz”. But it also has few additional ones as well.
  • Just like with “gzip”, “bzip2″ or many other compression tools in GNU/Linux, “pigz” only compresses single files. Thus, if you have a folder, then you’ll have to put it into a single file container, before you can compress it using “pigz”

Install Pigz in Ubuntu 12.04 / Ubuntu 11.10 /Linux Mint Lisa

pigz already available in Ubuntu Software repository and ready ti install in Ubuntu 12.04 Precise Pangolin, Ubuntu 11.10 Oneiric Ocelot, 11.04 Natty Narwhal, 10.10 and 10.04, you can install it by typing command below in your Terminal window:

sudo apt-get install pigz

or you can install via Ubuntu Software center, search “pigz” then install

How to use pigz in Ubuntu


If you’re someone a bit new, then below is a simple example of compressing a file named “testing” using it.

At the end, it’ll output a file named “filecom.gz”, in the same directory. But please remember to replace your source file’s name and its path with “testing”, (the “-k” parameter is used not to let “pigz” to delete the source file and “–best” means using the best possible compression levels).

pigz --best -k filecom


Decompression is pretty easy as the default file compression tool that comes with Ubuntu (called “File Roller”) or almost all the other GUI tools available in the GNU/Linux platform, should be able to read and extract the archives created by “pigz” as it’s based on the “gzip”.

However, if you’d like to use “pigz” for decompressing as well, To decompress (extract) the above mentioned compressed file, I’ll use the below command.

pigz -d filecom.gz

Again, make sure to replace “testing.gz” with your source file name and its path.

I can’t compress folders, why?

As mentioned before, you cannot compress folders with “pigz” as it only supports dealing with single files.

So as a fix, first you’ll have to use the “tar” utility (built into your GNU/Linux distribution) to put that folder and its content into a single file (not compressing it, just coping the content into a single file, almost like an another folder) and then you can compress that file with “pigz”.


Let’s say that I have a folder called “temp”, then I’ll use the below command in my Terminal to put that folder and its content into a single file called “my-single-file”. Again, make sure to replace “temp” & “my-single-file” with your desired files and their locations. Don’t change anything else.

tar -cf my-single-file temp

Then later you can use the “my-single-file” with “pigz” and compress it.

source: hecticgeek.com

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.