bat is a cat(1) clone that adds syntax highlighting and Git integration. It displays files with colorized output, shows Git modifications in a sidebar, and automatically pipes long output to a pager. It acts as a drop-in replacement for cat when output is redirected or piped.
Install & use
Install
git clone https://github.com/sharkdp/bat.git
Usage
bat README.md
sharkdp/bat is a third-party open-source project, listed here from public GitHub data. ImuTechz did not write it and has not reviewed or security-audited its code. Read the source and its permissions before you install or run it.
Features
Syntax highlighting for many programming and markup languages
Git integration showing modifications relative to the index
Show non-printable characters with -A/--show-all
Automatic paging with less (configurable)
File concatenation works like cat when piped
Integration with fzf, fd, ripgrep, tail, git, and man
Best for
Viewing source code with syntax highlighting
Inspecting Git diffs and file changes
Previewing files in fzf fuzzy finder
Reading man pages with colorized output
Pros
Drop-in replacement for cat with enhanced features
Automatic pager detection and fallback to plain output when piped
Wide language support for syntax highlighting
Built-in Git modification markers
Cons
On older Debian/Ubuntu the executable is named batcat
Stdin highlighting requires detectable shebang or explicit language