LinuxCommandLibrary

batcat

View file contents with syntax highlighting

TLDR

View documentation for the original command

$ tldr bat
copy

SYNOPSIS

batcat [OPTIONS] [FILE...]

PARAMETERS

-A, --show-all
    Show all whitespace (like cat -A)

-a, --style COMPONENTS
    Style elements: header, snip, changes, grid, line-number, rule (comma-separated)

-b, -n, --number
    Show line numbers at start of lines

-B, --number-non-blank
    Show line numbers only for non-blank lines

-C, --color WHEN
    Colorize: always, never, auto

-c, --paging MODE
    Paging: always, never, auto

-d, --decorations WHEN
    Decorations (e.g., grid): always, never, auto

-D, --terminal-width WIDTH
    Override terminal width (columns)

-f, --flatten
    Flatten directory trees to one file per line

-F, --show-filename
    Always show filename header

-H, --highlight-line RANGE
    Highlight specific lines (e.g., 1-3,42)

-h, --help
    Print help and exit

-i, --ignore-mode EXT
    Force syntax highlighting by extension

-l, --language LANG
    Force syntax highlighting by language

-L, --list-languages
    List supported languages and exit

-p, --plain
    Plain output, no highlighting/paging

-r, --recursive
    Recursively print directories

-S, --wrap MODE
    Wrapping: never, char, word, vline

-t, --tabs WIDTH
    Set tab width (default 4)

-T, --true-color
    Force truecolor output

-u
    Disable config file and colors

-V, --version
    Print version and exit

--theme THEME
    Syntax theme (e.g., Nord, Gruvbox-dark)

--map-syntax FROM:TO
    Map file syntax (e.g., *.foo:json)

--watch
    Watch files for changes and redraw

--style git
    Show git diff markers

DESCRIPTION

Batcat is an enhanced cat(1) clone designed for viewing code, logs, and files with rich features. It provides automatic syntax highlighting via the syntect engine, detecting over 400 languages. Key features include git diff markers (added/removed lines), line numbering, custom themes (like Gruvbox, Nord), automatic paging with less-like pager, and side-by-side diffs. It handles multiple files or directories, supports globbing and recursion, and customizes output with wrapping, tab widths, and decorations. Batcat is efficient, GPU-accelerated in some builds, and respects terminal colors/truecolor. Superior to plain cat for developers; outputs to stdout for piping. Install via package managers; config at ~/.config/batcat/batcat.conf.

CAVEATS

Requires UTF-8 locale; slower on huge files without GPU; pager may alter output when piping.

CONFIGURATION

Edit ~/.config/batcat/batcat.conf for defaults like theme=Nord, tab-width=4
List themes: batcat --list-themes

EXIT STATUS

0: success
1: general error (e.g., invalid args)
2: IO error
3: parsing error

HISTORY

Developed as bat by Andreas Gerstmayr (sharkdp) in 2018. Reached v1.0 in 2023. Renamed batcat in Debian/Ubuntu/Debian derivatives to avoid conflicts with other 'bat' tools.

SEE ALSO

cat(1), less(1), highlight(1), src-hilite-lesspipe(1)

Copied to clipboard