bat Cheatsheet
bat is a cat clone with syntax highlighting, line numbers, Git modification markers, theme support, and automatic language detection. Perfect for viewing code and config files in the terminal.
Updated: 2026-07-20·13 commands
Quick Start
``bash
bat app.py # View with syntax highlighting
bat -n config.yaml # Force line numbers
bat -l python Dockerfile # Force language
bat -r 10:30 main.go # Show line range
bat --theme Dracula file.rs # Pick a theme
alias cat='bat --paging=never'
``
Startup & Modes(13)
| Command | Level | ||
|---|---|---|---|
bat --helpShow bat help | Basic | bat --help | |
bat fileView file with syntax highlighting and line numbers | Basic | bat app.py | |
bat -AShow all characters (including non-printable) | Intermediate | bat -A config.yaml | |
bat -nForce line numbers (default on) | Basic | bat -n script.sh | |
bat -pPlain mode (no highlighting, no line numbers) | Basic | bat -p log.txt | |
bat -lForce language highlighting | Intermediate | bat -l python Dockerfile | |
bat --list-languagesList all supported languages | Basic | bat --list-languages | |
bat --themeSpecify color theme | Intermediate | bat --theme Dracula app.py | |
bat --list-themesList all available color themes | Basic | bat --list-themes | |
bat -rShow specific line range | Basic | bat -r 10:30 main.go | |
bat -fShow only filename and header (no content) | Intermediate | bat -f src/*.rs | |
alias cat=batUse bat instead of cat | Basic | alias cat='bat --paging=never' | |
bat --diffCombine file content with git diff view | Expert | bat --diff modified_file.py |
FAQ
This cheatsheet is compiled from official tool documentation. Last updated: 2026-07-20.