Ouch!
ouch stands for Obvious Unified Compression Helper.
It's a CLI tool for compressing and decompressing various formats.
Features
- Easy to use.
- Fast.
- Great error message feedback.
- No runtime dependencies.
- Accessibility mode (see more).
- Shell completions and man pages.
Usage
ouch has three main subcommands:
ouch decompress(aliasd)ouch compress(aliasc)ouch list(aliaslorls)
To see help for a specific command:
Decompressing
Use the decompress subcommand, ouch will detect the extensions automatically.
# Decompress multiple files
The -d/--dir flag can be used to redirect decompression results to another directory.
# Decompress 'summer_vacation.zip' inside of new folder 'pictures'
Compressing
Pass input files to the compress subcommand, add the output file at the end.
# Compress two files into `archive.zip`
# Compress file.txt using .lz4 and .zst
ouch detects the extensions of the output file to decide what formats to use.
Listing
# Example with tree formatting
Output:
└── src
├── archive
│ ├── mod.rs
│ ├── tar.rs
│ └── zip.rs
├── utils
│ ├── colors.rs
│ ├── formatting.rs
│ ├── mod.rs
│ └── fs.rs
├── commands
│ ├── list.rs
│ ├── compress.rs
│ ├── decompress.rs
│ └── mod.rs
├── accessible.rs
├── error.rs
├── cli.rs
└── main.rs
Supported formats
| Format | .tar |
.zip |
.7z |
.gz |
.sz |
.zst |
.xz |
.lzma |
.lz |
.bz, .bz2 |
.bz3 |
.lz4 |
.rar |
.br |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Supported | ✓ | ✓¹ | ✓¹ | ✓² | ✓² | ✓² | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓³ | ✓ |
✓: Supports compression and decompression.
✓¹: Due to limitations of the compression format itself, (de)compression can't be done with streaming.
✓²: Supported, and compression runs in parallel.
✓³: Due to RAR's restrictive license, only decompression and listing can be supported.
If you wish to exclude non-free code from your build, you can disable RAR support
by building without the unrar feature.
Aliases for these formats are also supported:
tar:tgz,tbz,tbz2,tlz4,txz,tlzma,tsz,tzst,tlz,cbtzip:cbz,epub7z:cb7rar:cbr
Formats can be chained:
.tar.gz.tar.gz.xz.zst.gz.lz4.sz
If the filename has no extensions, ouch will try to infer the format by the file signature and ask the user for confirmation.
Installation
Refer to the packages list on the right.
The most commonly used installation methods:
On Arch Linux
On MacOS via Homebrew
On Windows via Scoop
scoop install ouch
From crates.io
(If you're on Ubuntu, you might need to install clang to build it from crates.io.)
Download the latest release bundle
Check the releases page.
Release binaries are signed with Sigstore via GitHub's artifact attestations. Verify a downloaded binary with the GitHub CLI:
gh attestation verify ouch-x86_64-unknown-linux-musl --repo ouch-org/ouch
Reproducing a release build
Release builds are reproducible. Given the source at a tagged commit, anyone can rebuild the same binary and check that it matches what we shipped. Steps:
git clone https://github.com/ouch-org/ouch
cd ouch
git checkout <tag>
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
export RUSTFLAGS="--remap-path-prefix=$(pwd)=."
cargo build --locked --release --target <triple>
The toolchain version is pinned in rust-toolchain.toml and rustup will install it automatically. Cross-compiled targets (anything using cross-rs/cross) inherit the cross Docker image's toolchain, which is not pinned by digest yet, so those targets are bit-for-bit reproducible only against the same cross image release.
Compiling from source code
Check the wiki guide on compiling.
Benchmarks
Benchmark results are available here. Performance of compressing and decompressing Rust source code is measured and compared with Hyperfine. The values presented are the average (wall clock) elapsed time.
Note: ouch focuses heavily on usage ergonomics and nice error messages, but
we plan on doing some optimization in the future.
Versions used:
Contributing
Contributions of all sizes are welcome and appreciated!
- Open an issue.
- Package it for your favorite distribution or package manager.
- Share it with a friend!
- Open a pull request.
If you're creating a Pull Request, check CONTRIBUTING.md.