1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# 压缩
# target.zip 是压缩后的文件名
# source-dir 要压缩的文件夹名
zip -r target.zip source-dir
# 压缩保留软链, 只对类 unix 系统有效
# -y 保留软链
zip -ry target.zip source-dir
# 压缩带注释
zip -ryb target.zip source-dir
# 解压
unzip target.zip
# 查看压缩文件, 不压缩
unzip -v target.zip
unzip -l test.zip # 可以看到压缩包中的文件名,日期等信息
# 解压到指定文件夹 -d 指定文件夹
unzip target.zip -d target-dir/
# 自定义压缩率(1~9) 越高越耗时
zip -r8 target.zip target-dir/
# 向压缩包里更新文件
zip -u target.zip update/
# 压缩, 不带多余的目录
zip -rj target.zip target/
|