Gzip, Bzip2,Xz压缩

简介:

                Gzip 压缩工具


[root@binbinlinux ~]# gzip install.log.syslog     压缩命令gzip   不可以压缩目录

[root@binbinlinux ~]# ls

0.txt  1234.1   1.txt  anaconda-ks.cfg        test.txt

1      123.txt  222    install.log            tmp

111    12.txt   234    install.log.syslog.gz    压缩的文件带gz   yun

[root@binbinlinux ~]# du -sh install.log.syslog.gz

8.0K    install.log.syslog.gz

[root@binbinlinux ~]# gzip -1 压缩比例最少 然后压缩速度最快  9 压缩比例最大 压缩速度最慢   默然是6 级别  一共9级别   

[root@binbinlinux ~]# gzip -d install.log.syslog.gz      解压缩命令 -d  

[root@binbinlinux ~]# ls

0.txt  1234.1   1.txt  anaconda-ks.cfg     test.txt

1      123.txt  222    install.log         tmp

111    12.txt   234    install.log.syslog  yun

Gzip -c 1.sh。Gz > /usr/local/src/1.sh   输出的意思 从定向的意思

    Bzip2

[root@binbinlinux ~]# bzip2 install.log.syslog  压缩文件命令     不可以压缩目录  

[root@binbinlinux ~]# ls

0.txt  1234.1   1.txt  anaconda-ks.cfg         test.txt

1      123.txt  222    install.log             tmp

111    12.txt   234    install.log.syslog.bz2  yun

[root@binbinlinux ~]# du -sh  install.log.syslog.bz2

8.0K    install.log.syslog.bz2

[root@binbinlinux ~]# bzip2 -d  install.log.syslog.bz2   解压命令  

[root@binbinlinux ~]# ls

0.txt  1234.1   1.txt  anaconda-ks.cfg     test.txt

1      123.txt  222    install.log         tmp

111    12.txt   234    install.log.syslog  yun

[root@binbinlinux ~]# bzcat test.txt.bz2    查看bzip2 压缩的文件  

[root@binbinlinux ~]# zcat install.log.syslog.gz   查看 gz压缩的文件

Xz压缩

[root@binbinlinux ~]# xz 123.txt   压缩命令  

[root@binbinlinux ~]# ls

0.txt  111     123.txt.xz  1.txt  234              install.log         test.txt  yun

1      1234.1  12.txt      222    anaconda-ks.cfg  install.log.syslog  tmp

[root@binbinlinux ~]# xz -d 123.txt.xz     解压缩

[root@binbinlinux ~]# ls

0.txt  111     123.txt  1.txt  234    

[root@binbinlinux ~]# bzcat 123.txt.xz   查看123,命令


本文转自 amenging 51CTO博客,原文链接:http://blog.51cto.com/11335852/1980524


相关文章
|
8月前
|
存储 算法 Linux
使用 bzip2 进行文件压缩和解压缩
`bzip2` 是 Linux 中用于压缩和解压缩的命令,提供比传统方法更好的压缩效果。要压缩文件,使用 `bzip2 filename`(-k 保留原文件),解压缩则用 `bzip2 -d` 或 `bunzip2`。`bzcat` 或 `bzip2 -dc` 可查看压缩文件内容。`-1` 到 `-9` 选项可调整压缩级别(默认为 6)。注意备份重要文件,处理大文件时检查磁盘空间。
|
C++
c++ zlib(qt)压缩与解压缩
#include #include "zlib.h" #include "stdio.h" #include using   namespace   std;   #define MaxBufferSize 999999   void Test1(); void Test2();  ...
2177 0