Programming

Modern CLI Tools, Rewritten in Rust

·2 min read

A pattern from the last decade: take a venerable Unix tool, rewrite it in Rust, ship a single static binary, fix three things the original was annoying about. The result is a generation of CLI utilities that are faster, friendlier, and slot into existing workflows without any retraining. Here are the ones worth installing today.

ripgrep (rg) — the new grep

Recursive by default. Respects .gitignore automatically. Skips binary files. Faster than grep, ag, or ack by a wide margin on large trees because it uses SIMD-accelerated regex and parallel directory traversal.

rg "TODO"                      # search recursively from .
rg -t py "import requests"     # only Python files
rg -i "error" --hidden         # case-insensitive, include hidden files
rg -A 3 -B 1 "panic"           # context lines

fd — the new find

find's syntax is famously gnarly. fd defaults to what you usually want.

fd README                       # find README anywhere
fd -e log /var/log              # by extension
fd -H -I .env                   # include hidden and ignored
fd -e py -x black {}            # execute per match

bat — cat with syntax highlighting

Pipes cleanly to other tools (auto-detects when output is not a terminal). Shows git diff in the gutter for files in a repo.

bat main.rs
bat -p some.json | jq '.items'
alias cat=bat   # if you're brave

eza — the new ls

The successor to the older exa project. Colors, icons (with a Nerd Font), git status integration, tree view.

eza -la --git
eza --tree --level=2
eza --long --header --time-style=iso

dust — du, but readable

dust -d 2 ~        # tree of biggest consumers, depth 2
dust -r            # reverse — biggest first

hyperfine — proper benchmarking

Statistical command benchmarking. Warmup runs, outlier detection, markdown export.

hyperfine 'grep TODO -r .' 'rg TODO'
hyperfine --warmup 3 --runs 50 './my-binary'

Honorable mentions

  • zoxide — cd that learns. Type z proj instead of cd ~/work/projects/some-project.
  • delta — git pager with syntax-highlighted diffs.
  • tokei — fast SLOC counter.
  • sd — friendlier sed for simple find-and-replace.
  • starship — fast, configurable shell prompt.

Why does this keep happening?

Three reasons. Rust's tooling (cargo, crates.io) makes it easy to ship a single static binary that works on every Linux/macOS/Windows. Modern hardware (NVMe storage, parallel cores) makes I/O-bound tools radically faster when written to exploit it. And the original Unix tools were optimized for a different decade — terabyte-scale directory traversal and gitignore awareness weren't on the design list in 1979.

Related