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-rust2 / 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
# Rewrite entry paths: replace all occurrences of OLD with NEW (repeatable)
# Prepend a prefix to every extracted entry path
# Combine rename and prefix
# Short alias
Convert
# Convert to a different format (output path explicit)
# Derive output path from input stem + --to format
# (foo.tar.gz + --to tar-zst → foo.tar.zst alongside the input)
# Cross-family conversion (zip ↔ tar, zip ↔ 7z, etc.)
# Override the compression level of the output archive
# Overwrite existing output
# 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 |
--threads N |
Worker threads for parallel operations (0 = auto-detect) |
-V, --version |
Print version |
-h, --help |
Print help |
Encryption
ZIP and 7z archives support AES-256 encryption. Three mutually exclusive
password sources are available on all subcommands (compress, decompress,
list, test, info):
| Flag | Description |
|---|---|
--password-stdin |
Read password from stdin — recommended (not visible in process list or shell history) |
--password-file PATH |
Read first line of a file, trimmed of trailing whitespace |
--password STRING |
Inline password — UNSAFE (visible via ps and recorded in shell history) |
# Compress with password (recommended — reads from stdin)
|
# Decompress
|
# 7z also supported
|
|
Tar-based formats (tar, tar.gz, tar.zst, tar.xz, tar.bz2) do not
support encryption — rz will reject the password flags up front with a clear
error message.
Feature flags
| Feature | Effect |
|---|---|
xz2 |
Use C-backed liblzma for xz (typically faster) |
bzip2 |
Enable tar.bz2 support via C-backed libbz2 |
Without these features, xz uses the pure-Rust lzma-rust2 crate, which
streams in both directions; 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.zst memory usage: The pure-Rust
ruzstdencoder buffers the entire tar archive in memory before compressing. For large archives this can use significant RAM. - 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.