Site Tools


Hotfix release available: 2026-07-14c "Mort". upgrade now! [57.3] (what's this?)
Hotfix release available: 2026-07-14b "Mort". upgrade now! [57.2] (what's this?)
Hotfix release available: 2026-07-14a "Mort". upgrade now! [57.1] (what's this?)
New release available: 2026-07-14 "Mort". upgrade now! [57] (what's this?)
terminal:tools:bat

Table of Contents

bat

cat with syntax highlighting, line numbers, and git diff integration. Written in Rust.

bat file.py                 # view with syntax highlighting
bat -n file.py              # line numbers only (no decorations)
bat --plain file.py         # plain output (no line numbers, no pager)
bat -A file.py              # show non-printable characters
bat *.md                    # multiple files

As a pager — set as MANPAGER in ~/.profile:

export MANPAGER="sh -c 'col -bx | bat -l man -p'"
export PAGER=bat

With fzf — preview files:

fzf --preview 'bat --color=always {}'

Install

sudo apt install bat
# binary may be called batcat on Debian/Ubuntu — alias it:
alias bat='batcat'

See Also

terminal/tools/bat.txt · Last modified: by 127.0.0.1