zip 压缩
zip < 压缩文件名> < 源文件>
// 压缩文件

实例操作

[root@hexingxing ~]# zip 2.zip 2
adding: 2/ (stored 0%)
[root@hexingxing ~]# ll
总用量 112
drwxr-xr-x. 2 root root  4096 10 月  1 18:17 2
-rw-r--r--. 1 root root   154 10 月  1 20:11 2.zip

zip 压缩目录
zip -r < 压缩文件名> < 源目录>
// 压缩目录

实例操作

[root@hexingxing ~]# zip -r test 1
adding: 1/ (stored 0%)
adding: 1/2/ (stored 0%)
adding: 1/2/3/ (stored 0%)
adding: 1/2/3/8/ (stored 0%)
[root@hexingxing ~]# ll
drwxr-xr-x. 3 root root  4096 10 月  1 20:16 1
-rw-r--r--. 1 root root   574 10 月  1 20:17 test.zip

zip 压缩默认不删除源文件,如果未指定后缀名时自动添加为.zip 后缀

zip 解压
unzip < 压缩文件名>
// 解压文件

实例操作

[root@hexingxing ~]# unzip ztees.zip
Archive:  ztees.zip
creating: 1/

zip 解压到指定路径
unzip < 压缩文件名> -d < 解压路径>
// 解压文件到指定路径

实例操作

[root@hexingxing ~]# unzip te.zip -d /tmp
Archive:  te.zip
creating: /tmp/1/
creating: /tmp/1/2/
creating: /tmp/1/2/3/
creating: /tmp/1/2/3/8/

选项
zip 压缩
-m:压缩后删除源文件
-v:查看压缩详细操作信息
-r:递归文件和目录压缩
-e:压缩加密
-o:压缩时设置成源文件一样的时间
-u:更新压缩包,向压缩包添加新文件
-x:压缩时排除指定文件
-i:压缩时只包括指定文件

zip 解压缩
-v:查看压缩文件不解压
-t:测试压缩包有无损坏
-d < 目录> :解压到指定目录


友情提示:本站所有文章,如无特殊说明或标注,均为何星星原创发布。与此同时,趋于近年来本站的文章内容频繁被他站盗用与机器采集,现已全局禁用网站文字内容操作,了解详情或转载文章请 点此 继续!

0 条评论

发表回复

Avatar placeholder

您的电子邮箱地址不会被公开。 必填项已用*标注