ZIP例子
例1. 压缩test.MYI
[root@mysql test]# zip test1.zip test.MYI
adding: test.MYI (deflated 42%)
[root@mysql test]#ll
-rw-r–r– 1 root root 1033755 09-24 10:03 test1.zip
压缩率为8的
[root@mysql test]# zip test2.zip -8 test.MYI
adding: test.MYI (deflated 42%)
[root@mysql test]#ll
-rw-r–r– 1 root root 1033451 09-24 10:03 test2.zip
例2. 将当前目录下的所有文件和文件夹全部压缩成test.zip文件,-r表示递归压缩子目录下所有文件
[root@mysql test]# zip -r test.zip ./*
打包目录
[root@mysql test]# zip test2.zip test2/*
例3. 删除压缩文件test1.zip中test.MYI文件
[root@mysql test]# zip -d test1.zip test.MYI
删除打包文件目录下的文件
[root@mysql test]# zip -d test2.zip test2/ln.log
deleting: tests/ln.log
例4. 向压缩文件中test1.zip中添加test. MYI文件
[root@mysql test]# zip -m test1.zip test. MYI
例5. 压缩文件时排除某个文件
[root@mysql test]# zip test3.zip tests/* -x tests/ln.log
UNZIP的使用
演示示例:
unzip -t ziptext.zip #检查压缩文件是否正确
unzip -l ziptext.zip #查看列出压缩文件里的内容
unzip ziptext.zip #解压文件到当前目录
unzip -d /test/ ziptext.zip #解压文件到自定的目录
近期评论