On this page
Overview
bat is a CLI that displays file contents like cat(1) while adding syntax highlighting for source code and configuration files. It can show changes relative to the Git index, line numbers, and non-printable characters, and sends long output through a pager. When output is piped or redirected, it automatically falls back to plain cat-like content.
Features and best fit
Based on official documentation; not hands-on tested · Content checked:
Key features
Inspect syntax and Git changes in one terminal view
bat detects many programming and markup languages for syntax highlighting and marks lines changed from the Git index in the margin. The -A option reveals non-printable characters such as tabs and line endings, which helps when reviewing code or diagnosing configuration files.
Sources: [1]
Adapt long output and compose with other command-line tools
Output longer than one screen goes through a pager by default. When redirected to another process or file, decorations are removed so the content can continue through a pipeline. The README also documents use with fzf, fd, git show, and continuously updated logs.
Sources: [1]
Best fit
Fits workflows that inspect source and configuration files from the shell
bat is useful when a file needs a quick readable view without opening an editor, or when search results need to be previewed one at a time. It also suits developers and operators who want line numbers, diffs, and highlighting through one command.
Sources: [1]
Before adoption
Check pager behavior, executable naming, and license terms
Interactive terminals enable automatic paging, so use --paging=never when cat-compatible behavior is required consistently. Ubuntu and Debian packages may install the executable as batcat because of a naming conflict. Version 0.26.1 is offered under either the MIT License or Apache License 2.0; review both license files for your distribution choice.
Official sources
- [1]bat README at v0.26.1(2026-10-04)
- [2]bat v0.26.1 release(2026-10-04)
- [3]bat Apache License 2.0 text at v0.26.1(2026-10-04)
- [4]bat MIT License text at v0.26.1(2026-10-04)
Supplemental curator note
If you plan to replace cat, test both interactive viewing and redirected or piped output. Checking existing aliases and pager settings first makes bat easier to adopt without surprising shell behavior.
Try it in 3 steps
- 1
Install bat with Homebrew
This is the official README path for macOS or Linux.
brew install bat - 2
Create a Rust file to display
Create a small file with an LF-terminated final line in the current directory.
printf '%s\n' 'fn main() {' ' println!("hello");' '}' > bat-demo.rs - 3
Inspect line numbers and highlighting
Use documented display options to check Rust highlighting and line numbers.
bat --style=numbers --color=always bat-demo.rs
Growth
Growth trends · Last 30 days
60,668 Stars
Trend data is still being collected.
Development activity
Last 90 days · weekly
- Commits (last 30 days)
- 5
- Open PRs
- 206
Development activity is still being collected.
Built with
Categories and tags
Categories
GitHub data
GitHub dataView detailed GitHub data
GitHub Topics
- command-line
- tool
- syntax-highlighting
- git
- terminal
- cli
- rust
- hacktoberfest
- Stars
- 60,668
- Forks
- 3,349
- Watchers
- 250
- Open issues
- 333
- Contributors
- 491
- Owner type
- User
- Primary language
- Rust
- License
- Apache-2.0
- Repository last updated
- Oct 1, 2026
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- Rust119,449 Stars
1 shared tag(s) · Same language
use ownership and static typing for memory safety while retaining low-level control without a GC
Rust - fd44,635 Stars
3 shared tag(s) · 1 shared category(s) · Same language
Find files and directories quickly with regex patterns and practical defaults
Rust - delta32,413 Stars
3 shared tag(s) · 1 shared category(s) · Same language
make Git, diff, and grep output easier to read with syntax highlighting and word-level changes
Rust - ripgrep68,825 Stars
2 shared tag(s) · 1 shared category(s) · Same language
recursively search directories for regex patterns while respecting
Rust.gitignoreto navigate large codebases quickly - Git63,582 Stars
2 shared tag(s) · 1 shared category(s)
keep complete history locally and synchronize repositories as distributed peers
C - Aider49,359 Stars
2 shared tag(s) · 1 shared category(s)
edit code from the terminal with repository-wide context
Python
Report incorrect information
Tell us if any listing information is incorrect or outdated.