English | 中文
Two commands for packing and unpacking archives. unpack identifies the format from file headers and extracts it. pack creates archives in the format you specify.
No need to remember whether to use tar, unzip, or 7z, or what -xzf, -xJf, -czf, -d, -o means for which tool. Just unpack <file> and pack <dir>.
brew tap ChunzhengLab/tap
brew install unpackSee homebrew-tap for details.
unpack [OPTIONS] <ARCHIVE> [DEST]
unpack sniff <FILE>...
unpack list <ARCHIVE>
unpack project.tar.gz # → ./project/
unpack archive.zip -C /tmp # → /tmp/archive/
unpack mystery.bin # auto-detect from file header
unpack sniff mystery.bin # what format is this file?
unpack list project.tar.gz # preview contents without extracting
unpack project.tar.gz --here # extract into current directory
unpack --dry-run project.tar.gz # show what would happen
unpack --format tar.gz mystery.bin # override all detection-C, --into <DIR> Extract into specified directory
--here Extract into current directory (no subdirectory)
-o, --overwrite Allow overwriting existing files
--format <FMT> Override format detection (e.g. tar.gz, zip, 7z)
--dry-run Show what would happen without extracting
-v, --verbose Show detailed output
-l, --list Same as 'unpack list'
pack [OPTIONS] <SRC> [OUT]
pack mydir/ # → mydir.zip (default format)
pack mydir/ output.tar.gz # format from extension
pack mydir/ output.7z # 7z archive
pack file.txt output.gz # single-file compression
pack mydir/ output.tar.lz4 # tar + lz4
pack -f tar.gz mydir/ # explicit format
pack --dry-run mydir/ # show what would happen-f, --format <FMT> Output format (e.g. zip, tar.gz, 7z)
--dry-run Show what would happen without packing
-o, --overwrite Allow overwriting existing output file
-v, --verbose Show detailed output
- Default format is
.zipwhen no output path is given --formatand output extension must agree, or an error is raised- Directories cannot be packed into single-file formats (
.gz,.bz2,.xz,.lz4,.zst) — use the matching.tar.*variant instead
| Format | unpack | pack | Backend |
|---|---|---|---|
.tar .tar.gz .tgz .tar.bz2 .tbz2 .tar.xz .txz .tar.lz4 .tar.zst |
yes | yes | tar / lz4 |
.zip |
yes | yes | unzip / zip |
.7z |
yes | yes | 7z / 7zz |
.rar |
yes | — | 7z / 7zz |
.iso |
yes | — | 7z / 7zz |
.gz |
yes | yes | gunzip / gzip |
.bz2 |
yes | yes | bunzip2 / bzip2 |
.xz |
yes | yes | xz |
.lz4 |
yes | yes | lz4 |
.zst |
yes | yes | zstd |
- Auto subdirectory:
unpackextracts multi-file archives to./<archive-stem>/, not the current directory. - No overwrite: both commands refuse to clobber existing files. Use
-oto override. - Header sniffing:
unpackreads the file header to identify the format, even when the extension is wrong or missing. - Missing tool reporting: clear error message naming the missing tool and the format it handles.