• Stars
    star
    2,154
  • Rank 21,414 (Top 0.5 %)
  • Language
    Rust
  • License
    Other
  • Created over 3 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Painless compression and decompression in the terminal

Crates.io link License

Ouch!

ouch stands for Obvious Unified Compression Helper.

It's a CLI tool for compressing and decompressing for various formats.

Features

  1. Easy to use.
  2. Fast.
  3. Great error message feedback.
  4. No runtime dependencies required (for Linux x86_64).
  5. Accessibility mode (see more).
  6. Shell completions and man pages.

Usage

Ouch has three main subcommands:

  • ouch decompress (alias d)
  • ouch compress (alias c)
  • ouch list (alias l or ls)

To see help for a specific command:

ouch help <COMMAND>
ouch <COMMAND> --help  # equivalent

Decompressing

Use the decompress subcommand, ouch will detect the extensions automatically.

ouch decompress a.zip

# Decompress multiple files
ouch decompress a.zip b.tar.gz c.tar

The -d/--dir flag can be used to redirect decompression results to another directory.

# Decompress 'summer_vacation.zip' inside of new folder 'pictures'
ouch decompress summer_vacation.zip --dir pictures

Compressing

Pass input files to the compress subcommand, add the output file at the end.

# Compress two files into `archive.zip`
ouch compress one.txt two.txt archive.zip

# Compress file.txt using .lz4 and .zst
ouch compress file.txt file.txt.lz4.zst

ouch detects the extensions of the output file to decide what formats to use.

Listing

ouch list archive.zip

# Example with tree formatting
ouch list source-code.zip --tree

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 .gz .xz, .lzma .bz, .bz2 .lz4 .sz .zst
Supported โœ“ โœ“ยน โœ“ยฒ โœ“ โœ“ โœ“ โœ“ยฒ โœ“

โœ“: Supports compression and decompression.

โœ“ยน: Due to limitations of .zip, it doesn't support streaming (de)compression.

โœ“ยฒ: Supported, and compression runs in parallel.

tar aliases are also supported: tgz, tbz, tbz2, tlz4, txz, tlzma, tsz, tzst.

Formats can be chained:

  • .zst.gz
  • .tar.gz.gz
  • .tar.gz.gz.gz.zst.xz.bz.lz4

If the filename has no extensions, Ouch will try to infer the format by the file signature.

Installation

Packaging status

On Arch Linux

pacman -S ouch

On Windows via Scoop

scoop install ouch

From crates.io

cargo install ouch

Download the latest release bundle

Check the releases page.

Compiling from source code

Check the wiki guide on compiling.

Dependencies

If you installed ouch using the download script, you will need no dependencies (static MUSL binary).

Otherwise, you'll need these libraries installed on your system:

These are available on all mainstream Linux distributions and on macOS.

Benchmarks

Benchmark results are available here. Performance of compressing and decompressing Rust source code are 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

ouch is made out of voluntary work, contributors are very welcome! No contribution is too small and all contributions are valued.

  • Open an issue.
  • Package it for your favorite distribution or package manager.
  • Open a pull request.
  • Share it with a friend!