bat
A cat clone with syntax highlighting and Git integration
Built by @sharkdp on GitHub. This page was written by @iluxav from public sources, last updated for v0.26.1 (2025-12-02), and may lag behind new releases.
Maintain bat? Claim itPrint files in the terminal with syntax highlighting, line numbers and Git change markers, paged automatically, and plain like cat when piped.
What you can do with it
See which lines were added, removed or modified relative to the Git index, in the left margin.
Good to know
Needs the file to be inside a Git repository.
Show and highlight non-printable characters such as tabs, spaces and line endings with `-A`/`--show-all`.
Page long output through a pager automatically, and print plain contents like `cat` when output is piped.
Good to know
Uses an external pager such as less.
Print only selected line ranges of a file with `--line-range`.
Choose a color theme and which decorations (line numbers, Git changes, header, grid) to show.
Set default options in a configuration file instead of on every command line.
Collapse runs of empty lines with `-s`/`--squeeze-blank`, optionally keeping up to N with `--squeeze-limit`.
Print shell completions for your shell with `bat --completion <shell>`.
Before you upgrade
Newest firstWhen piping, decorations are no longer added unexpectedly: only line numbers requested on the command line are applied in auto mode.
Error messages now go to stderr by default, and `-n` line numbers are printed when output is piped.
Read the evidence
Building from source needs Rust 1.74 or newer.
Read the evidence
Show 5 older
`--map-syntax` patterns now match case-insensitively by default.
Read the evidence
Building from source needs Rust 1.70 or newer.
Read the evidence
Environment variables such as `BAT_THEME` now override the config file (command-line arguments still win); unset variables you do not want to take precedence.
Building from source needs Rust 1.62 or newer.
Read the evidence
On macOS the default theme depends on whether Dark Mode is on.
Release history 10
Read `bat --help` in the pager.
Details
`-h` and `--help` are paged; when piping in auto decorations mode, only line numbers asked for on the command line are applied, for `cat` compatibility.
v0.26.1.
Seeded by @iluxav with Claude Code (canido)
Page output without installing less, using bat's built-in pager.
Details
`--pager=builtin` uses a built-in pager; line ranges accept negative relative ranges (`-r :-10`) and context (`-r 30::5`); `--list-themes` pages. Errors go to stderr by default, and `-n` line numbers now print when output is piped.
v0.26.0; Windows ARM64 builds are new.
Seeded by @iluxav with Claude Code (canido)
Get a light or dark theme picked automatically from your terminal's color scheme.
Details
The theme follows the terminal's light or dark scheme; `-s`/`--squeeze-blank` and `--squeeze-limit` collapse empty lines; `--strip-ansi` removes escape sequences from input; `--style=+numbers` adds or removes single style components; `--binary=as-text` prints binary content; `--completion <shell>` prints shell completions.
Also: The terminal title shows the file names while paging.
v0.25.0; building from source needs Rust 1.74.
Seeded by @iluxav with Claude Code (canido)
Control paging from the environment with `BAT_PAGING`.
Details
New `BAT_PAGING` environment variable; `--map-syntax` matches case-insensitively by default; optional `LESSOPEN`/`LESSCLOSE` support when built with `--features lessopen`.
v0.24.0; building from source needs Rust 1.70.
Seeded by @iluxav with Claude Code (canido)
Show non-printable characters in caret notation such as `^I`.
Details
`--nonprintable-notation=caret`; `-S`/`--chop-long-lines` as aliases for `--wrap=never`. Environment variables now override config file settings, while command-line arguments still win.
v0.23.0; building from source needs Rust 1.62.
Seeded by @iluxav with Claude Code (canido)
Keep shared settings in a system-wide config file and personal ones in your own.
Details
bat reads a system config file and a user config file. On macOS the default theme follows Dark Mode. Groups v0.22.0 and v0.22.1.
v0.22.1.
Seeded by @iluxav with Claude Code (canido)
Get a less cluttered default output without configuring styles.
Details
`--style=default` is added and is now the default, less verbose than `full`. File extensions match case-insensitively; lines over 16,384 characters are not highlighted; startup is faster through lazy-loaded syntaxes.
Also: BusyBox less works as a pager.
v0.21.0.
Seeded by @iluxav with Claude Code (canido)
Show the size of the file in the header.
Details
New style component `header-filesize`; line highlighting uses an underline with the ANSI theme.
v0.20.0.
Seeded by @iluxav with Claude Code (canido)
Show a window around a line with relative ranges such as `20:+10`.
Details
Line ranges accept `x:+delta` and `x:-delta`; `--ignored-suffix` ignores backup suffixes for syntax detection; `$BAT_CONFIG_DIR` sets the config directory. Startup is faster in loop-through mode.
Also: `--acknowledgements` credits theme and syntax authors; the requirements.txt syntax was removed for licensing reasons.
v0.19.0; building from source needs Rust 1.51.
Seeded by @iluxav with Claude Code (canido)
Starting point
Read files in the terminal with syntax highlighting and Git change markers.
Details
State before the covered window: `bat <file>` highlights many languages, marks Git changes in the margin, pages long output, and behaves like `cat` when piped; `--theme`, `--style`, `--line-range` and a configuration file control the output.
v0.18.3 and earlier; packaged by most distributions (as `batcat` on Debian/Ubuntu).
Seeded by @iluxav with Claude Code (canido)