Skip to main content

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)

CommandLevel
bat --help
Show bat help
Basic
bat file
View file with syntax highlighting and line numbers
Basic
bat -A
Show all characters (including non-printable)
Intermediate
bat -n
Force line numbers (default on)
Basic
bat -p
Plain mode (no highlighting, no line numbers)
Basic
bat -l
Force language highlighting
Intermediate
bat --list-languages
List all supported languages
Basic
bat --theme
Specify color theme
Intermediate
bat --list-themes
List all available color themes
Basic
bat -r
Show specific line range
Basic
bat -f
Show only filename and header (no content)
Intermediate
alias cat=bat
Use bat instead of cat
Basic
bat --diff
Combine file content with git diff view
Expert

FAQ

This cheatsheet is compiled from official tool documentation. Last updated: 2026-07-20.