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


相关文章
|
16天前
|
Unix Linux
gzip/gunzip命令
`gzip` 和 `gunzip` 是 Linux/Unix 的压缩工具,用于压缩(`.gz`)和解压缩文件。`gzip` 使用 LZ77 和 Huffman 编码,支持递归压缩目录、设置压缩级别及保留源文件等选项。例如:`gzip file` 压缩文件,`gzip -d` 或 `gunzip` 解压缩。用户常通过调整选项完成所需操作,如`gzip -k`压缩后保留原文件。
22 4
|
16天前
|
Linux
bzip2/bunzip2命令
`bzip2` 和 `bunzip2` 是Linux命令行下的压缩和解压缩工具,采用Burrows-Wheeler变换和Huffman编码,提供比`gzip`更高的压缩率。`.bz2`是压缩文件的扩展名。`bzip2`命令用于压缩,基础语法是`bzip2 [选项] 文件名`,常用选项包括`-c`, `-d`, `-k`, `-v`, `-z`和压缩级别设置。`bunzip2`用于解压缩,基本语法是`bunzip2 [选项] 文件名.bz2`,同样有`-c`, `-k`, `-v`选项。`bzip2 -d`等同于`bunzip2`,两者可互换使用。
25 5

热门文章

最新文章