bat is a clone of the classic cat command that adds syntax highlighting, Git integration, and automatic paging on top of the same basic job of printing file contents to the terminal. It's built for developers who read source files, configs, and logs in the terminal often and want that output easier to scan than plain cat gives you.
.sublime-syntax definitions for anything missing.less when it's too large for one screen, while still behaving like plain cat when output is piped elsewhere.-A/--show-all flag reveals and highlights non-printable characters in a file.--style..tmTheme themes.fzf, a printer for ripgrep results via batgrep, a colorizing man pager, and a --help colorizer.--generate-config-file) instead of passed as flags every time, and a systemwide config file is also supported.bat can be wired up to switch themes automatically based on the OS's light/dark setting.bat is a good fit for anyone who wants a nicer default for viewing files in the terminal, whether that's aliasing it over cat, using it as a git diff/git show colorizer, or wiring it into fzf or ripgrep as a preview pane. It's especially useful if you spend a lot of time reading code or config files in a terminal with truecolor support.
It's not meant to replace a text editor, since it's read-only output rather than an editing tool, and it's not the best choice for scripting where you need guaranteed plain output (the --plain flag or piping bypasses the decorations, but a plain cat is simpler for that job). On terminals without truecolor support, some default themes look worse, so picking one of the 8-bit themes matters more there.
bat is packaged for most major systems. A few examples from the README:
Ubuntu/Debian:
sudo apt install bat
(on some older releases the binary is named batcat instead of bat)
Arch Linux:
pacman -S bat
Fedora:
dnf install bat
macOS or Linux via Homebrew:
brew install bat
Windows via WinGet:
winget install sharkdp.bat
To build from source, you need Rust 1.79.0 or higher:
cargo install --path . --locked
or, from crates.io:
cargo install --locked bat
Prebuilt binaries, including statically-linked musl builds, are also available from the GitHub releases page for a wide range of architectures.
Once installed, bat --list-themes and bat --list-languages show what's available, and bat --config-file prints the path to your configuration file for that system. The project also documents troubleshooting steps for common issues: garbled output from files containing raw ANSI escape sequences can be fixed with --strip-ansi=auto or by disabling highlighting and wrapping, and non-UTF-8 files typically need converting with iconv first since encodings can't reliably be auto-detected.
For untrusted input specifically, the --sanitize option goes further than --strip-ansi alone, also replacing terminal-active control bytes and Unicode formatting characters that could otherwise manipulate the terminal display. The project maintains a small, named group of maintainers, and security issues can be reported through the process documented in SECURITY.md rather than as a public issue.