
This implies that the Pigz command-line tool is much faster than the Gzip toolįor more details on the usage of pigz command, visit the man pages. Here are the results: Gzip Compression $ time gzip Ĭheck Gzip Compression Time Pigz Compression $ time pigz Ĭheck Pigz Compression Time Gzip Decompression $ time gzip -d Ĭheck Gzip Decompression Time Pigz Decompression $ time unpigz įrom the comparison, we can clearly see that compression and decompression times for Pigz are much shorter than Gzip. We went a bit further and pitted Pigz against Gzip tool.
Compress file iso#
Using our compressed ISO file, the command will be: $ pigz -d ĭecompress Files in Linux Comparison between Pigz vs Gzip

To decompress a file or directory using pigz, use the -d option or the unpigz command. In this example, below, we have used the best compression (denoted by -9) with 4 processors (-p4) while retaining the original file (-k). You can specify the number of cores to be used using the -p option. We mentioned earlier that the pigz utility tool uses multiple cores & processors when compressing files.
Compress file how to#
To compress a directory, use the -use-compress-program argument as shown: $ tar -use-compress-program="pigz -k " -cf dir1Ĭompress a Directory in Linux How to Limit the Number of Processors While Compressing As a workaround, pigz is used in conjunction with tar command to zip directories. 1 – Fastest but offers the least compression.įor example, to compress the file with the best compression level, execute: $ pigz -9 īy itself, Pigz does not have options to compress a folder, it only compresses single files.The following compression levels are supported: To check the contents of the compressed file, including the statistics on the compression ratio achieved use the -l option with pigz command: $ pigz -l įrom the output, you not only get to see the contents of the zipped file but also the percentage of compression which in this case is 1.9%.Īdditionally, you can use various compression levels that exist from 1 to 9. Check Content of Compressed File in Linux

$ pigz -k įrom the output, we can clearly see that the original file has been retained even after compression.

To retain the original file after compression, run use the -k option as shown. However, the command deletes the original file upon compression as you might have noticed. In this guide, we will use the file for demonstration purposes.
