[Linux] 6 Linux 压缩命令

Linux 压缩命令

Posted by Mr.Vincent on 2019-07-14
Estimated Reading Time 1 Minutes
Words 368 In Total
Viewed Times

tar

命令 语法 参数 参数说明
tar tar [-cxzjvf] 压缩打包文档的名称 欲打包目录
-c 建立一个归档文件的参数指令
-x 解开一个归档文件的参数指令
-z 是否需要用 gzip 压缩
-j 是否需要用 bzip2 压缩
-v 压缩的过程中显示文件
-f 使用档名,在 f 之后要立即接档名
-tf 查看归档文件里面的文件

例子:

  • 压缩文件夹:tar -zcvf test.tar.gz test\
  • 解压文件夹:tar -zxvf test.tar.gz

gzip

命令 语法 参数 参数说明
gzip gzip [选项] 压缩(解压缩)的文件名
-d 解压缩
-l 对每个压缩文件,显示压缩文件的大小,未压缩文件的大小,压缩比,未压缩文件的名字
-v 对每一个压缩和解压的文件,显示文件名和压缩比
-num 用指定的数字num调整压缩的速度,-1或–fast表示最快压缩方法(低压缩比),-9或–best表示最慢压缩方法(高压缩比)。系统缺省值为6

说明:压缩文件后缀为 gz

bzip2

命令 语法 参数 参数说明
bzip2 bzip2 [-cdz]
-d 解压缩
-z 压缩参数
-num 用指定的数字num调整压缩的速度,-1或–fast表示最快压缩方法(低压缩比),-9或–best表示最慢压缩方法(高压缩比)。系统缺省值为6

说明:压缩文件后缀为 bz2


If you like this blog or find it useful for you, you are welcome to comment on it. You are also welcome to share this blog, so that more people can participate in it. If the images used in the blog infringe your copyright, please contact the author to delete them. Thank you !