unzip是 Linux/Unix 解压 ZIP 格式压缩包的工具。
基本语法
unzip [选项] 压缩包.zip常用选项
| 选项 | 说明 |
|---|---|
-l | 列出内容(不解压) |
-d 目录 | 解压到指定目录 |
-o | 覆盖已存在文件 |
-n | 不覆盖已存在文件 |
-j | 忽略目录结构 |
-x 文件 | 排除指定文件 |
-t | 测试完整性 |
示例
unzip test.zip # 解压到当前目录
unzip docs.zip -d ./output # 解压到指定目录
unzip -l backup.zip # 查看内容
unzip -t secret.zip # 测试完整性
unzip images.zip pics/photo.jpg # 解压单个文件
unzip -o update.zip # 覆盖已存在文件
unzip data.zip -x temp.log # 排除文件
unzip -j archive.zip # 忽略目录结构注意
- 安装:
sudo apt install unzip - 中文乱码:
unzip -O GBK 中文压缩包.zip
压缩使用 zip。