Get the App
SLTechnology News&Howtos  ›  Development  › 

How to install and use pigz commands in Linux

Shulou Source: shulou.com Published: 2022-06-01 15:21:37 09月16日 Update

Most people do not understand the knowledge points of this article "how to install and use pigz commands in Linux", so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to install and use pigz commands in Linux" article.

Pigz command can be used to extract files, the most important thing is to support multi-threaded parallel processing, decompression is faster than gzip. Pigz time is 60% faster than gzip, while CPU consumption is several times that of gzip. Of course, the CPU utilization rate of pigz is also 100%.

Environment

Centos7 RAM:2GB, CPU: 4vcpus

Install # install epel extension source [root@localhost ~] # wget-O / etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo[root@localhost ~] # yum makecache# install pigz [root @ localhost ~] # yum-y install pigz how to compress files

The following are common parameters:

-p n: the number of cores used when compressing. By default, all cores are used-k: keep the source file after compression-l: list the compressed input. -6: default compression level-9: highest compression ratio, but slow speed-1: lowest compression ratio, fastest

For example: compress the FreeNAS-11.2-U7.iso file. If you need to keep the source file, you can add the-k parameter:

[root@localhost] # pigz-k FreeNAS-11.2-U7.iso

You can use the-l option to view the compression ratio of the compressed file:

[root@localhost ~] # pigz-l FreeNAS-11.2-U7.iso.gzcompressed original reduced name576426218 602378240 4.3% FreeNAS-11.2-U7.iso

How to compress a directory

Pigz has no option to compress folders, you can only compress individual files. Pigz can be used with the tar command to compress folders.

[root@localhost ~] # tar-cvf-/ var/log | pigz-k > logs.tar.gz

Check the compression information:

[root@localhost ~] # pigz-l logs.tar.gzcompressed original reduced name 698038 9093120 92.3% logs.tar [root@localhost ~] #

How to extract a file

Extract a single file, decompression method:

[root@localhost test] # unpigz-d FreeNAS-11.2-U7.iso.gz# if you need to keep the source zip file, add the-k parameter [root@localhost test] # pigz-k-d FreeNAS-11.2-U7.iso.gz

Decompress a directory, decompression method:

[root@localhost test] # tar-xf logs.tar.gz above is the content of this article on "how to install and use pigz commands in Linux". I believe you all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about it, please follow the industry information channel.

Tags: File content command parameter single folder article method core source file directory knowledge article speed lowest fastest highest important value utilization Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn MariaDB Redmi MySQL Shulou Information