Find your next open-source project

Search by name, purpose, or keyword — or paste a GitHub repository URL

A cat replacement for the terminal that adds syntax highlighting, Git change markers, and automatic paging.

61,201
3,068
Rust
Apache-2.0
8 years old

What it does

bat replaces cat for interactive terminal reading. It renders file contents with syntax highlighting for many programming and markup languages, shows Git index changes in a side column, and can reveal non-printable characters with -A/--show-all. By default it pages long output through less or the configured pager, while falling back to plain cat-style output whenever stdout is not an interactive terminal README lines 22–53. It is written in Rust and published as a CLI tool, with a library interface available for applications that want its pretty-printing features.

Quick start

On Ubuntu 20.04+, Debian 11+, and other Debian-based systems, install from the distribution package:

sudo apt install bat

Some older releases install the binary as batcat to avoid a package name clash. If bat --version fails, check batcat --version and create a symlink or alias README lines 256–277. Then read a file:

bat README.md

The file content is displayed with highlighting, line numbers, and a file header. Use bat src/*.rs for multiple files, or bat -A /etc/hosts to highlight non-printable characters README lines 54–85. For package-manager alternatives, Homebrew, WinGet, Chocolatey, Scoop, Nix, and prebuilt release binaries are listed in the README's installation section.

Using it in pipelines

When output is piped or redirected, bat prints plain content unless decorations are forced. This keeps it compatible with commands such as bat main.cpp | xclip and with writing files through redirection README lines 168–175. For fzf previews, force color with --color=always; for tail -f, disable paging and specify a language explicitly:

tail -f /var/log/pacman.log | bat --paging=never -l log

README lines 135–141

Constraints

Syntax highlighting works best in a truecolor terminal; otherwise choose the built-in 8-bit themes. bat handles UTF-8 and UTF-16 natively, and other encodings need conversion such as iconv before display README lines 877–885. On Windows, install the Visual C++ Redistributable and provide a suitable pager such as less for paging. Custom syntaxes and themes must be placed in the config directory and compiled with bat cache --build. The project is dual-licensed under MIT or Apache-2.0.

HotRepo's take

bat is a mature, widely used utility with 61,118 stars and 3,055 forks as of the November 6, 2026 snapshot, where it added 128 stars in the Rust daily ranking and placed 16th. Hacker News discussion around the v0.26.0 release focused on the new built-in pager and the trade-off between Unix composability and an integrated viewing experience; one commenter with several years of use described it as a well-thought-through drop-in replacement for cat/less comment. The project sits comfortably in the productivity category: it is not a new or experimental tool, but a stable terminal reader whose value lies in everyday file inspection rather than in benchmark claims.

Written by AI from the project's README, updated . The project's own docs are the source of truth.

Hacker News

Bat: Cat with syntax highlighting
▲ 191 · 95 comments · October 5, 2025
Bat v0.26.0
▲ 149 · 74 comments · October 20, 2025
bat, a cat(1) clone with syntax highlighting, Git integration written in Rust
▲ 40 · 6 comments · October 21, 2020