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.
- Syntax highlighting. bat supports a large number of programming and markup languages, coloring keywords, strings, and comments as you'd see them in an editor.
- Line numbers and file headers. Output is laid out with a gutter, a header showing the filename, and a grid — so you know what you're looking at and where.
- Git integration. bat talks to git and shows which lines have been added, removed, or modified relative to the index, marked right in the sidebar.
- Automatic paging. When output is too long for one screen, bat pipes it through a pager (by default
less).
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.