bat
A cat clone with syntax highlighting and Git integration.
bat displays files with line numbers, syntax highlighting, and a git diff column when the file is in a repository, then pages output through less when the content is long. It is a friendly drop-in for the venerable cat utility — most users alias bat over cat for interactive use, while keeping the original cat for scripts.
David Peter writes bat in Rust, alongside fd and several other modern Rust replacements for classic Unix tools. Distribution is a single static binary, with packages in most major distributions. The default theme set is broad and covers dark, light, and several popular terminal colour schemes.
bat is one of the more universally-adopted tools in the "modern Unix" set. The combination of friendly colour output, the pager integration, and the git-status column makes it a small quality-of-life upgrade that costs nothing to adopt. It pairs well with ripgrep (also from David Peter) for "search and preview" workflows.
Install
Debian/Ubuntu: sudo apt install bat # binary is batcat on Debian Fedora/RHEL: sudo dnf install bat Arch: sudo pacman -S bat macOS: brew install bat
Authors
- David Peter (creator)