rz
A multi-format archive tool written in Rust. Compress, decompress, test, list,
and inspect tar, zip, and 7z archives through a single, consistent CLI — no
more remembering whether it's tar xzf, unzip, or 7z x.
Supported formats
| Format | Extension(s) | Compression | Backend |
|---|---|---|---|
| tar | .tar |
none | tar |
| tar+gzip | .tar.gz, .tgz |
gzip | flate2 |
| tar+zstd | .tar.zst, .tzst |
Zstandard | ruzstd |
| tar+xz | .tar.xz, .txz |
LZMA2 | lzma-rs / xz2 |
| tar+bzip2 | .tar.bz2, .tbz2 |
bzip2 | bzip2 (opt-in) |
| zip | .zip |
Deflate | zip |
| 7z | .7z |
LZMA2 | sevenz-rust2 |
Format is auto-detected from the output extension (compress) or magic bytes
then extension (decompress/list/info). You can override with --format.
Installation
From source
With optional C-backed codecs
The default build is pure Rust. For faster xz and bzip2 via C libraries:
Nix
Or run directly:
Prebuilt binaries
Download from the releases page. Binaries are provided for Linux (x86_64, aarch64), macOS (x86_64, aarch64), and Windows (x86_64).
Usage
Compress
# Compress a directory (format inferred from extension)
# Compress multiple inputs
# Explicit format, custom compression level
# Exclude patterns (glob, repeatable)
# Read exclude patterns from a file (one per line)
# Read input file list from a file (one path per line)
# Exclude version-control directories and backup files
# Respect .gitignore rules
# By default, symlinks are stored as symlinks (tar-family and zip).
# Use -H / --follow-symlinks to archive the target's content instead.
# Do not recurse into directories
# Dry run: show what would be compressed without creating an archive
# Print total bytes processed at the end
# Compress to stdout (tar-based formats; requires --format)
|
# Short alias
Decompress
# Extract to current directory
# Extract to a specific directory
# Strip the top-level directory wrapper
# Exclude files during extraction
# Read exclude patterns from a file (one per line)
# Extract only matching files (--include glob or positional paths)
# Extract a file to stdout
# Read archive from stdin (tar-based formats; requires --format)
|
# Overwrite existing files
# Skip existing files silently instead of erroring
# Only extract entries newer than existing files on disk
# Flatten directory structure (extract all files into output dir)
# Backup existing files instead of overwriting (appends .bak)
# Restore original file permissions from archive metadata
# Dry run: show what would be extracted without writing to disk
# Print total bytes processed at the end
# Short alias
List
# List archive contents
# Detailed output (permissions, sizes)
# Filter listing
# Read exclude patterns from a file
# Sort entries
# Human-readable sizes
# Short alias
Test
# Verify archive integrity (fully decompress without writing to disk)
# ok
# Short alias
Info
# Show archive metadata
# Format: tar.gz
# Entries: 42
# Compressed: 1048576 bytes
# Uncompressed: 3145728 bytes
# Human-readable sizes
Global options
| Flag | Description |
|---|---|
-p, --progress |
Show a progress bar |
-v, --verbose |
Print each entry name to stderr |
-q, --quiet |
Suppress all non-error output |
-V, --version |
Print version |
-h, --help |
Print help |
Feature flags
| Feature | Effect |
|---|---|
xz2 |
Use C-backed liblzma for xz (streaming, faster) |
bzip2 |
Enable tar.bz2 support via C-backed libbz2 |
Without these features, xz uses the pure-Rust lzma-rs crate (buffers the
archive in memory before compressing) and bzip2 is unavailable.
Known limitations
- tar.zst compression level: The pure-Rust
ruzstdencoder currently only supports a single compression level (Fastest, roughly zstd level 1).--level 0selects uncompressed framing; all other values useFastest. - tar.xz / tar.zst memory usage: Without the
xz2feature, xz and zstd compression buffers the entire tar archive in memory before compressing. For large archives, consider enabling thexz2feature for streaming xz. - 7z format: Does not support
--strip-components. Extracts contents flat (does not preserve the top-level directory wrapper). - Stdin/stdout streaming: Only tar-based formats support
-for stdin/stdout. ZIP and 7z require seekable I/O and will error. - Symlinks: tar-family and zip store symlinks as links by default; pass
-H/--follow-symlinksto archive the target's content instead. The zip extractor inrzdoes not yet recreate stored links on disk (they extract as text files containing the target path); tar does. 7z follows symlinks unconditionally on compress — a limitation of thesevenz-rust2backend. - Zip list -l: Per-entry sizes and permissions are not shown for zip archives
in long-listing mode. The upstream
zipcrate does not expose central directory metadata without seeking to each entry's local file header, which would negate the performance benefit of reading only the central directory. Listing zip entry names (without-l) is instant regardless of archive size.