码迷,mamicode.com
首页 > 其他好文 > 详细

gzip,bzip2,xz压缩工具

时间:2018-04-16 20:41:31      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:gzip   bzip2   xz   

压缩打包介绍
  • windows:.rar .zip .7z
  • linux: .zip,.gz,.bz2,.xz,.tar.gz,.tar.bz2,.tar.xz

gzip压缩工具

  • gzip 1.txt压缩文件
    [root@aminglinux-02 d6z]# gzip 1.txt 
    [root@aminglinux-02 d6z]# ls
    1.txt.gz
  • gzip -# 1.txt //#范围1-9,默认6,9压缩最狠,不能压缩目录
  • gzip -d 1.txt.gz / gunzip 1.txt.gz解压缩文件
    [root@aminglinux-02 d6z]# gzip -d 1.txt.gz 
    [root@aminglinux-02 d6z]# ll
    总用量 2996
    -rw-r--r--. 1 root root 3065940 6月  22 21:03 1.txt
    [root@aminglinux-02 d6z]# gunzip 1.txt.gz
    [root@aminglinux-02 d6z]# ls
    1.txt
  • zcat 1.txt.gz查看压缩文件,实际是先解压缩在查看
  • gunzip -c /root/1.txt.gz > /tmp/1.txt解压缩文件到另一个目录,并保留源压缩文件
  • gzip -c /root/1.txt > /tmp/1.txt.gz压缩文件到另一个目录,并保留源文件
  • file 1.txt.gz可以查看文件的类型
    [root@aminglinux-02 d6z]# file 1.txt 
    1.txt: C source, UTF-8 Unicode text
    [root@aminglinux-02 d6z]# gzip 1.txt 
    [root@aminglinux-02 d6z]# file 1.txt.gz 
    1.txt.gz: gzip compressed data, was "1.txt", from Unix, last modified: Thu Jun 22 21:03:53 2017

bzip2压缩工具

  • bzip2 1.txt / bzip2 -z 1.txt压缩文件,不能压缩目录
  • bzip2 -d 1.txt.bz2 / bunzip2 1.txt.bz2解压文件
  • bzip -# 1.txt //#范围1-9,默认9
  • bzcat 1.txt.bz2查看压缩文件
  • bzip2 -c 1.txt > /root/1.txt.bz2压缩文件到另一个目录,并保留源文件
  • bzip2 -c -d /root/1.txt.bz2 > /tmp/2.txt解压缩文件到另一个目录并改名,并保留源压缩文件

xz压缩工具

  • 用法和和上面两个一样,压缩比最狠为xz,其次是bzip2,最后是gz

gzip,bzip2,xz压缩工具

标签:gzip   bzip2   xz   

原文地址:http://blog.51cto.com/akui2521/2104112

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!