bat

bat

Rust-powered cat clone with syntax highlighting, Git modification markers, automatic paging, and drop-in pipe compatibility.

★ 61.6K

Read code in your terminal clearly with bat

Running cat on a 300-line config file dumps a wall of monochrome text into your terminal with no line numbers and no hint of what changed since your last commit. bat replaces that wall with clean syntax highlighting, line numbers, and a Git diff gutter. Built in Rust under a dual MIT and Apache-2.0 license, it has 61.6K GitHub stars, 2,300 forks, and over 2,600 dependent repositories.

How bat upgrades your command line

  • It highlights code across hundreds of programming and markup languages using Sublime Text syntax definitions and switches automatically between dark and light terminal themes.
  • The left sidebar marks uncommitted Git additions, modifications, and deletions directly next to the line numbers.
  • When you pipe output into another command or redirect to a file, bat detects the non-interactive stream and behaves like plain POSIX cat with zero borders or escape codes.
  • It plugs cleanly into fzf --preview, colorizes man pages via MANPAGER, and formats --help output for any CLI tool.

Practical caveats

On older Debian and Ubuntu systems, the package installs the binary as batcat to avoid a name collision with an existing Bacula utility, so you need a quick symlink or shell alias. It also reads UTF-8 and UTF-16 natively, meaning legacy Latin-1 files must pass through iconv first.

Quick takeaway

Install bat and wire it into your shell aliases and fzf previews for an immediate readability upgrade in any terminal session.

Ready to try bat?

Experience the full capabilities on their official website.

Visit Official Website