DDevLogTechnical writing
Tools

Meet bat, the cat clone with syntax highlighting and Git smarts

September 19, 2026

You reach for cat a dozen times a day to peek at a config, skim a script, or check a log. It works. It's also plain white text with no line numbers, no color, and no hint of what changed since your last commit.

Then there's bat — a cat(1) clone written in Rust by David Peter, described on its GitHub repo as "a cat(1) clone with wings." Same job, far better view.

What makes bat different

At its core, bat does what cat does: it prints the contents of one or more files to the terminal. The difference is in the details.

If you're not on an interactive terminal — say you pipe bat into another program — it quietly falls back to acting as a drop-in replacement for cat, printing plain content so scripts keep working.

Useful in the real world

A few commands make the value obvious:

bat README.md                    # read a file with highlighting
bat src/*.rs                     # several files at once
curl -s https://sh.rustup.rs | bat   # colorize piped input
git show v0.6.0:src/main.rs | bat -l rs   # view an old file

You can force the language with -l, show only changed lines with --diff, or slim down the chrome with --style=numbers,changes. Set BAT_STYLE to keep your preferred style across sessions.

Make it your daily driver

To make bat behave like plain cat forever, alias it:

alias cat='bat --paging=never'

On Ubuntu 20.04 "Focal" and newer (and Debian 11 and newer) you can install it simply with sudo apt install bat. Note that on some older Debian and Ubuntu releases the binary is named batcat instead of bat. On macOS, Homebrew users can grab it with brew install bat.

One honest caveat

bat isn't the fastest on enormous files, and on very old systems you may run into the batcat name quirk. Neither is a dealbreaker for everyday use. As of the latest release, version 0.26.1 (December 2025), the tool stays actively maintained.

If you read files in a terminal more than a few times a day, bat turns a chore into something pleasant. Same job, better view — that's the whole pitch. Try it once and you may not go back.

← More Tools