频道栏目
首页 > 资讯 > Linux > 正文

Linux命令——压缩与解压命令

17-03-06        来源:[db:作者]  
收藏   我要投稿

常用的压缩格式及命令

压缩格式 压缩命令 解压命令
.gz gzip gunzip / gzip -d
.tar tar -cf tar -xf
.tar.gz tar -zcf tar -zxf
.zip zip /zip -r unzip
.bz2 bzip2 bunzip2
.tar.bz2 tar -cjf tar -xjf

gzip

压缩文件,不保留源文件,不能压缩目录

gunzip

解压.gz格式的压缩文件 gzip -d 也能解压文件

tar

压缩

-v 压缩详情
-c 打包
-f 指定文件
-z 打包的同时压缩
[root@localhost tmp]# tar -zcvf file.tar.gz file*
file001
file002
[root@localhost tmp]# ls
dire  file001  file002  file.tar.gz
[root@localhost tmp]# 

解压

-x 解包
[root@localhost tmp]# ls
dire  file.tar.gz
[root@localhost tmp]# tar -zxf file.tar.gz 
[root@localhost tmp]# ls
dire  file001  file002  file.tar.gz

zip

压缩比例较低

-r 压缩目录
[root@localhost tmp]# ls
direc1  file001.txt  file002.txt  file.txt  svi
[root@localhost tmp]# zip f.zip file.txt 
adding: file.txt (stored 0%)
[root@localhost tmp]# ls
direc1  file001.txt  file002.txt  file.txt  f.zip  svi
[root@localhost tmp]# zip -r dir.zip direc1
adding: direc1/ (stored 0%)
adding: direc1/dfile (stored 0%)
adding: direc1/dfile2 (stored 0%)
[root@localhost tmp]# ls
direc1  dir.zip  file001.txt  file002.txt  file.txt  f.zip  svi

解压

../../article/20220623/file.html

bzip2

压缩比比较好,建议使用

-k 保留源文件
相关TAG标签
上一篇:关于某些域环境下Windows Hello无法使用的解决方法
下一篇:一些数据库的常识
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站