.tar (Tape Archive) 是 Unix/Linux 系統傳統打包格式(僅歸檔不壓縮),常搭配 gzip (.tar.gz/.tgz)、bzip2 (.tar.bz2/.tbz2)、xz (.tar.xz/.txz) 壓縮。Windows 可用多種工具開啟。
tar -xvf file.tar 原生指令操作。Expand-Archive -Path file.tar -DestinationPath . (支援 .tar.gz 等需先解壓縮)。
| 副檔名 | 完整名稱 | 壓縮演算法 |
|---|---|---|
| .tar | Tape Archive | 無 (僅打包) |
| .tar.gz / .tgz | Gzip compressed tar | DEFLATE (gzip) |
| .tar.bz2 / .tbz2 | Bzip2 compressed tar | Burrows-Wheeler (bzip2) |
| .tar.xz / .txz | XZ compressed tar | LZMA2 (xz) |
| .tar.zst / .tzst | Zstd compressed tar | Zstandard (zstd) |
# 解包 (自動偵測壓縮)
tar -xvf file.tar
tar -xzvf file.tar.gz
tar -xjvf file.tar.bz2
tar -xJvf file.tar.xz
tar --zstd -xvf file.tar.zst
# 打包壓縮
tar -czvf archive.tar.gz /path/to/source
Windows 環境建議安裝 7-Zip 或 Bandizip,右鍵選單一鍵解壓,支援最完整。