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

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值