pigz, unpigz

It means that “A parallel implementation of gzip for modern multi-processor, multi-core machines”

pigz, which stands for parallel implementation of gzip, is a fully functional replacement for gzip that exploits multiple processors and multiple cores to the hilt when compressing data. pigz was written by Mark Adler, and uses the zlib and pthread libraries.

Manual

SYNOPSIS

pigz [ −cdfhikKlLmMnNqrRtz0…9,11 ] [ -b blocksize ] [ -p threads ] [ -S suffix ] [ name … ]
unpigz [ −cfhikKlLmMnNqrRtz ] [ -b blocksize ] [ -p threads ] [ -S suffix ] [ name … ]

DESCRIPTION

Pigz compresses using threads to make use of multiple processors and cores. The input is broken up into 128 KB chunks with each compressed in parallel. The individual check value for eachchunk is also calculated in parallel. The compressed data is written in order to the output, and acombined check value is calculated from the individual check values.

The compressed data for mat generated is in the gzip, zlib, or single-entr y zip for mat using the deflate compression method. The compression produces partial raw deflate streams which are concatenated byasingle write thread and wrapped with the appropriate header and trailer, where the trailer contains the combined check value.

Each partial raw deflate stream is terminated by an empty stored block (using the Z_SYNC_FLUSH option of zlib), in order to end that partial bit stream at a byte boundary. That allows the partial streams to be concatenated simply as sequences of bytes. This adds a ver y
small four to five byte overhead to the output for each input chunk.

The default input block size is 128K, but can be changed with the -b option. The number of compress threads is set by default to the number of online processors, which can be changed using the -p option. Specifying -p 1 avoids the use of threads entirely.

The input blocks, while compressed independently, have the last 32K of the previous block loaded as a preset dictionary to preser ve the compression effectiveness of deflating in a single thread.This can be turned off using the -i or --independent option, so that the blocks can be decompressed independently for partial error recovery or for random access. This also inserts an extra empty block to flag independent blocks by prefacing each with the nine-byte sequence (in hex): 00 00 FF FF 00 00 00 FF FF.

Decompression can’t be parallelized, at least not without specially prepared deflate streams for that purpose. Asaresult, pigz uses a single thread (the main thread) for decompression, but will create three other threads for reading, writing, and check calculation, which can speed up decompression under some circumstances. Parallel decompression can be turned off by specifying one process ( -dp 1 or -tp 1 ).

All options on the command line are processed before any names are processed. If no names are provided on the command line, or if “-” is given as a name (but not after “–”), then the input is taken from stdin. If the GZIP or PIGZ environment var iables are set, then options are taken from their values before any command line options are processed, first from GZIP, then from PIGZ.

Compressed files can be restored to their original for m using pigz -d or unpigz.

OPTIONS

-# --fast --best

Regulate the speed of compression using the specified digit #, where −1 or −−fast indicates the fastest compression method (less compression) and −9 or −−best indicates the
slowest compression method (best compression). -0 is no compression. −11 gives a few
percent better compression at a severe cost in execution time, using the zopfli algorithm
by Jyr ki Alakuijala. The default is −6.

-A --alias xxx

Use xxx as the name for any --zip entry from stdin (the default name is “-”).

-b --blocksiz e mmm

Set compression block size to mmmK (default 128KiB).

-c --stdout --to-stdout

Wr ite all processed output to stdout (won’t delete).

-C --comment ccc

Include the provided comment in the gzip header or zip central file header.

-d --decompress --uncompress

Decompress the compressed input.

-f --force

Force overwr ite, compress .gz, links, and to terminal.

-h --help

Displayahelp screen and quit.

-H --huffman

Compress using the Huffman-only strategy.

-i --independent

Compress blocks independently for damage recovery.

-k --keep

Do not delete original file after processing.

-K --zip

Compress to PKWare zip (.zip) single entry for mat.

-l --list List the contents of the compressed input.

-L --license

Display the pigz license and quit.

-m --no-time

Do not store or restore the modification time. -Nm will store or restore the name, but not
the modification time. Note that the order of the options is important.

-M --time

Store or restore the modification time. -nM will store or restore the modification time, but
not the name. Note that the order of the options is important.

-n --no-name

Do not store or restore the file name or the modification time. This is the default when
decompressing. When the file name is not restored from the header, the name of the
compressed file with the suffix stripped is the name of the decompressed file. When the
modification time is not restored from the header, the modification time of the compressed file is used (not the current time).

-N --name

Store or restore both the file name and the modification time. This is the default when
compressing.

-p --processes n

Allow up to n processes (default is the number of online processors)

-q --quiet --silent

Pr int no messages, even on error.

-r --recursive

Process the contents of all subdirectories.

-R --rsyncable

Input-deter mined block locations for rsync.

-S --suffix .sss

Use suffix .sss instead of .gz (for compression).

-t --test

Test the integrity of the compressed input.

-U --rle

Compress using the run length encoding strategy.

-v --verbose

Provide more verbose output.

-V --version

Show the version of pigz. -vV also shows the zlib version.

-z --zlib

Compress to zlib (.zz) instead of gzip for mat.

All arguments after “–” are treated as file names (for names that start with “-”)
These options are unique to the -11 compression level:

-F --first

Do iterations first, before block split (default is last).

-I, --iterations n

Number of iterations for optimization (default 15).

-J, --maxsplits n

Maximum number of split blocks (default 15).

-O --oneblock

Do not split into smaller blocks (default is block splitting).

Install

  1. sudo apt install pigz
    2.source is here

Demos

pigz [options] [files …]
-0 to -9, -11 : 压缩级别
-p n : 指定压缩核心数,默认8个
-k :压缩后保留原文件

压缩文件,压缩后生成 filename.gz文件

pigz -9 -k filename #使用cpu 的所有核数进行压缩

pigz -6 -p 10 -k filename

pigz -5 -k -p 40 src.tar

tar cvf - test/ | pigz -9 -p 40 -f > test.tar.gz

tar cf - test/ | pigz -9 -f > test.tar.gz

解压文件

gzip -d filename.gz

ungzip filename.gz

pigz -d filename.gz

unpigz filename.gz

linux平台下一个好用的并行压缩工具(cpu核数越多越快,比tar -j可以快很多倍)相关推荐

  1. linux平台下防火墙iptables原理(转)

    原文地址:http://www.cnblogs.com/ggjucheng/archive/2012/08/19/2646466.html iptables简介 netfilter/iptables( ...

  2. 【转】在 Linux 平台下使用 JNI

    引言 Java 的出现给大家开发带来的极大的方便.但是,如果我们有大量原有的经过广泛测试的非 Java 代码,将它们全部用 Java 来重写,恐怕会带来巨大的工作量和长期的测试:如果我们的应用中需要访 ...

  3. linux共享文件丢失,【干货分享】linux平台下数据文件被误删后,如何及时得知并进行恢复...

    原标题:[干货分享]linux平台下数据文件被误删后,如何及时得知并进行恢复 我们知道在windows平台下,一旦文件在程序中打开,则不能被删除,所以不存在误删数据文件的情况,如下图所示. 但是在LI ...

  4. linux算法设计,嵌入式Linux平台下随机序列算法设计.doc

    嵌入式Linux平台下随机序列算法设计 嵌入式Linux平台下随机序列算法设计 [摘 要]本文以多媒体播放器的随机不重复播放机能为切入点,针对嵌入式平台实时性要求高,处理速度不够快,但系统存储歌曲量大 ...

  5. (转)Thrift在Windows及Linux平台下的安装和使用示例

    转载自Thrift在Windows及Linux平台下的安装和使用示例 thrift介绍 Apache Thrift 是 Facebook 实现的一种高效的.支持多种编程语言的RPC(远程服务调用)框架 ...

  6. 在 Linux 平台下使用 JNI

    原文地址: http://www.ibm.com/developerworks/cn/java/l-linux-jni/ 引言 Java 的出现给大家开发带来的极大的方便.但是,如果我们有大量原有的经 ...

  7. Linux 平台下基于Qt 的电子地图的绘制

    Linux 平台下基于Qt 的电子地图的绘制 摘要-------------------------------------------1   关键词------------------------- ...

  8. linux小型游戏系统设计,Linux平台下基于JAVA小游戏_设计文档.doc

    Linux课程设计报告 课题名称:<Linux平台下基于java小游戏设计> 专 业:2011级计算机科学与技术 组 长:043佘清泉 组 员:007陈威达 008陈学仁 026赖华标 0 ...

  9. 使用Jexus实现ASP.NET在Linux平台下的部署

      Hello,大家好,我是Payne,欢迎大家关注我的博客,我的博客地址是https://qinyuanpei.github.io.今天想写一点关于Linux部署ASP.NET相关的话题,为什么突然 ...

最新文章

  1. 织梦html引入html代码,织梦标签引入共html.doc
  2. 列选主元guass消去法
  3. fileupload控件在ajax中无法使用
  4. 我从吴恩达 AI For Everyone 中学到的十个重要 AI 观
  5. 《BI项目笔记》创建标准维度、维度自定义层次结构
  6. U-Det:一种改进的双向特征网络U-Net结构用于肺结节分割
  7. vue-cli 3.0
  8. Python之time与datetime模块
  9. 12通过作用域链实现闭包
  10. 10无法更新系统_2020年4月公积金网上系统更新后无法登陆故障解决办法
  11. Matlab | matpower5.0:最优潮流执行步骤及修改教程
  12. 2013年全国天线年会参展商名录及观展指南
  13. matlab建立遗传算法,Matlab遗传算法(一)
  14. Matlab实现两个矩阵的加法、乘法计算器
  15. 证书与签名(一):数字签名是什么
  16. 地铁一公里造价达7亿元,大部分城市无法回本,为何还抢着建?
  17. 备忘录形成html乱码,浏览器icloud网页版备忘录乱码不能显示中文汉字-企业网站设计之中的字体坑...
  18. 探讨一种新型的双进程守护应用保活
  19. AI WORLD2016世界人工智能大会:中国力量崛起
  20. frame,iframe

热门文章

  1. Spring IoC 和 AOP
  2. php图片写入带问号_关于编码:PHP输出显示带有问号的黑色小菱形
  3. 简述空串和空格串(或称空格符串)的区别。
  4. opencascade 0xXXXXXXXX处最可能的异常: 0xC0000005: 写入位置 0x00000014 时发生访问冲突
  5. ZOJ - 3939 The Lucky Week【简单方法】
  6. ffmpeg libx264 h264_nvenc 编码参数解析
  7. 【SpringCloudAlibaba学习 04】整合Dubbo(实现数据消费者服务调用数据生产者服务)
  8. 云之讯融合通讯开放平台_提供融合语音,短信,VoIP,视频和IM等通讯API及SDK。...
  9. 精品微信小程序预约挂号小程序+后台管理系统|前后分离VUE
  10. 正则表达式与遇到的问题