zoukankan      html  css  js  c++  java
  • linux 之 压缩 / 解压

    压缩解压

    tar 即可压缩也可以解压

    c 压缩    如果没有z、j参数,则表示,只打包,不压缩。 就说,

    t 查看

    z  以gzip方式压缩     相当于 gzip ?。。

    j  以bzip方式压缩    bzip2 ??

    drwxr-xr-x 5 root root 4096 Apr 21 09:30 etccc/  

    tar cvf etccc.zip etccc/
    -rw-r--r-- 1 root root 2027520 Apr 21 17:50 etccc.zip  

    tar zcvf etccc.zip.gz etccc/        ----- 以zip.gz结尾不是必须的, 
    -rw-r--r-- 1 root root 95930 Apr 21 17:51 etccc.zip.gz    --- 对比大小可见,压缩效果还是很显著的

    gzip

    gzip date.txt           貌似只能对文件进行gzip压缩,  不需要指定压缩目标文件名
    linux:/opt/lktest/TEST # l
    total 12
    drwxr-xr-x 2 root root 4096 Apr 21 17:08 ./
    drwxr-xr-x 31 root root 4096 Apr 21 09:29 ../
    -rw-r--r-- 1 root root 34 Apr 21 17:07 date.txt.gz   ———— gzip压缩结果默认以gz结尾

    linux:/opt/lktest # gzip TEST
    gzip: TEST is a directory -- ignored

    gunzip

    zcat   zcat  is  identical  to gunzip -c

    bzip    貌似没有bzip命令,只有bzip2

    bzip2

    linux:/opt/xx # bzip2
    bzip2: I won't write compressed data to a terminal.
    bzip2: For help, type: `bzip2 --help'.
    linux:/opt/xx # bunzip2
    bunzip2: I won't read compressed data from a terminal.
    bunzip2: For help, type: `bunzip2 --help'.

    SHELL在执行一个UNIX命令时,自动打开三个文件:stdin(标准输入)、stdout(标准输出
    )、stderr(标准错误),文件描述字分别是0、1、2。所以,上面语句中的"2"表示标准错误的

    标准输出 ? 如何重定向?

    compress  ? 好像还需要安装,我本机是不可以执行的。

    参考

    http://www.cnblogs.com/Thomson-Blog/articles/1335034.html

  • 相关阅读:
    git操作
    计算天数
    web小结~2019.3.24
    数据统计值的计算+PYTHON
    python~序列类型及操作
    一个日期加上若干天后是什么日期
    完数与盈数
    分段函数
    求最大最小
    D进制的A+B
  • 原文地址:https://www.cnblogs.com/FlyAway2013/p/3678944.html
Copyright © 2011-2022 走看看