7-zip#
7zip 是一款高效的開源檔案壓縮工具,支援多種壓縮格式,包括其專有的 7z 格式。7zip 以其卓越的壓縮率和靈活的功能而聞名,適用於 Windows、Linux 和 macOS 等多種作業系統。 Description
Install#
$ sudo apt install p7zip-fullOperate#
$ 7z [command] [options] [archive name] [file ...]| operation | description |
|---|---|
| a | 建立新的壓縮檔案或向現有壓縮檔案添加檔案 |
| x | 解壓縮檔案,保留完整路徑 |
| e | 解壓縮檔案,不保留路徑 |
| l | 列出壓縮檔案的內容 |
| t | 測試壓縮檔案的完整性 |
| d | 從壓縮檔案中刪除指定檔案 |
| u | 更新壓縮檔案中的檔案 |
| -p[password] | 使用密碼保護壓縮檔案 |
| -m[method] | 指定壓縮方法(如 LZMA2、PPMd 等) |
| -mx=[0-9] | 設定壓縮級別,0 為無壓縮,9 為最大壓縮 |
Examples#
| example command | description |
|---|---|
| 7z a archive.7z file.txt | 將 file.txt 壓縮到 archive.7z |
| 7z x archive.7z | 解壓縮 archive.7z,保留路徑 |
| 7z e archive.7z | 解壓縮 archive.7z,不保留路徑 |
| 7z l archive.7z | 列出 archive.7z 的內容 |
| 7z t archive.7z | 測試 archive.7z 的完整性 |
| 7z d archive.7z file.txt | 從 archive.7z 中刪除 file.txt |
| 7z a -pMyPassword archive.7z file.txt | 使用密碼 MyPassword 壓縮 file.txt 到 archive.7z |
| 7z a -mx=9 archive.7z file.txt | 以最大壓縮級別壓縮 file.txt 到 archive.7z |
Reference#
Official docs: