Lampros - Weird Bricks

Replacing gzip and bzip2 with their parallel alternatives pigz and pbzip2

02 July, 2017 | CentOS

Almost all modern systems come with more than 1 core. Why not get a significant performance gain from any application that uses gzip and bzip2 simply by switching to their multi-core cousins?

Wait, how do I know that I have more than one core on my host?

Easy! Use the nproc command:


Replace gzip with pigz first:

pigz is in the extras repository for CentOS:

yum -y install pigz
mv /usr/bin/gzip /usr/bin/gzip.old
ln -s /usr/bin/pigz /usr/bin/gzip

Replace bzip2 with pbzip2:

To install pbzip2, we need to install the EPEL repository first:

yum -y install epel-release
yum -y install pbzip2
mv /bin/bzip2 /bin/bzip2.old
ln -s /bin/pbzip2 /bin/bzip2

Note that sometimes bzip2 does not come pre-installed, in this case you'll see an error like this, when trying the above commands:

mv /bin/bzip2 /bin/bzip2.old
mv: cannot stat ‘/bin/bzip2’: No such file or directory

You can safely ignore this and proceed anyways.

Confirm that pigz is in place:

gzip --version
pigz 2.3.3

Confirm that pbzip2 is in place:

bzip2 --version
Parallel BZIP2 v1.1.12 [Dec 21, 2014]
By: Jeff Gilchrist []
Major contributions: Yavor Nikolov []
Uses libbzip2 by Julian Seward

We're good to go!