Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and use pigz commands in Linux

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report