linux使用pigz多线程压缩

因为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" # 不解压

转载于:https://www.cnblogs.com/ExMan/p/11139511.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值