zoukankan      html  css  js  c++  java
  • 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" # 不解压

  • 相关阅读:
    tomcat常见报错解决方法汇总
    C++中socket编程
    Winsock解析
    等价类划分的原则
    在线编译器
    条件覆盖,路径覆盖,语句覆盖,分支覆盖解释
    并发测试
    针对C程序员的 C++
    缸中之脑
    什么是薛定谔的猫
  • 原文地址:https://www.cnblogs.com/ExMan/p/11139511.html
Copyright © 2011-2022 走看看