首页 > 编程语言 > 详细

linux使用pigz多线程压缩

时间:2019-07-05 17:22:14      阅读:140      评论:0      收藏:0      [点我收藏+]

因为tar zip是单线程的压缩,压缩起来很慢,这个使用使用pigz工具辅助就会使用多线程了。

安装

sudo apt install pigz

压缩

tar cvf - test.txt | pigz > test.tar.gz

解压到指定目录

转自: http://unix.stackexchange.com/questions/198958/unpigz-and-untar-to-a-specific-directory

  1.  
    I found three solutions:
  2.  
    With GNU tar, using the awesome -I
  3.  
    option:
  4.  
    tar -I pigz -xvf /path/to/archive.tar.gz -C /where/to/unpack/it/
  5.  
     
  6.  
    With a lot of Linux piping (for those who prefer a more geeky look):
  7.  
    unpigz < /path/to/archive.tar.gz | tar -xvC /where/to/unpack/it/
  8.  
     
  9.  
    More portable (to other tar
  10.  
    implementations):
  11.  
    unpigz < /path/to/archive.tar.gz | (cd /where/to/unpack/it/ && tar xvf -)
  12.  
     
  13.  
    (You can also replace tar xvf -
  14.  
    with pax -r
  15.  
    to make it [POSIX](https://en.wikipedia.org/wiki/POSIX)-compliant, though not necessarily more portable on Linux-based systems).
  16.  
     
  17.  
    Credits go to [@PSkocik](http://unix.stackexchange.com/users/23692/pskocik) for a proper direction, [@Stéphane Chazelas](http://unix.stackexchange.com/users/22565/st%C3%A9phane-chazelas) for the 3rd variant and to the author of [this](http://stackoverflow.com/a/29270282/2202101) answer.

使用tar+pigz+ssh实现大数据的高效传输, 流式压缩传输

http://www.cnblogs.com/chjbbs/p/6472236.html
磁盘读取---->打包---->压缩------>传输---->解压缩-->拆包---->落盘
|->tar |->gzip |->ssh |->gzip |->tar
tar -c test/ |pigz |ssh -c arcfour128 目标IP "gzip -d|tar -xC /data" # 解压
tar -c test/ |pigz |ssh -c arcfour128 目标IP "cat >/data/test.tar.gz" # 不解压

技术分享图片

linux使用pigz多线程压缩

原文:https://www.cnblogs.com/ExMan/p/11139511.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!