A fast, user-friendly command-line alternative to the Unix find command for locating files and directories by name.
sharkdp/bat
A cat(1) clone for the terminal with syntax highlighting, Git change markers, and automatic paging.
- Stars
- 60,873
- Forks
- 4,382
- Open issues
- 567
- Last commit
- 15 hours ago
What is it?
bat is a command-line tool that prints file contents to the terminal like cat, but with syntax highlighting, line numbers, and a header showing the filename. It marks lines changed relative to the Git index in a left sidebar, and it can show non-printable characters when asked.
When output is longer than one screen, bat pipes it to a pager such as less by default. When its output is redirected to a file or another process, it behaves like a plain cat, so it can be used in scripts and pipelines. Its appearance can be controlled through themes, style components, and a configuration file.
bat also works as a previewer for tools like fzf and fd, and it can colorize man pages and --help output. Custom syntaxes and themes can be added from Sublime Text formats.
Key features
- 01Syntax highlighting for a wide range of programming and markup languages.
- 02Git integration that marks lines modified relative to the index.
- 03Automatic paging for long output, and plain cat-like output when piped.
- 04Configurable themes, style components, and a config file.
- 05Custom syntax and theme support through Sublime Text formats.
- 06Works as a colorizing pager for man and --help output.
Use cases
- Viewing source code or config files in the terminal with highlighting.
- Previewing files inside fzf or fd searches.
- Reviewing a file's recent Git changes while reading it.
- Replacing cat in shell aliases while keeping plain output for scripts.
Quick start
- 1
Install bat with Homebrew (macOS or Linux)
brew install bat - 2
Display a single file in the terminal
bat README.md
Topics
FAQ
- What is bat?
- A cat(1) clone for the terminal with syntax highlighting, Git change markers, and automatic paging. bat is a command-line tool that prints file contents to the terminal like cat, but with syntax highlighting, line numbers, and a header showing the filename. It marks lines changed relative to the Git index in a left sidebar, and it can show non-printable characters when asked.
- Is bat free to use? What license does it have?
- bat is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is bat still maintained?
- Actively maintained. The last commit to bat was on Oct 20, 2026.
- What can I use bat for?
- Viewing source code or config files in the terminal with highlighting. Previewing files inside fzf or fd searches. Reviewing a file's recent Git changes while reading it. Replacing cat in shell aliases while keeping plain output for scripts.
- How do I install bat?
- Install bat with Homebrew (macOS or Linux): brew install bat Display a single file in the terminal: bat README.md
- Where can I get bat?
- The source code and installation instructions are on GitHub: https://github.com/sharkdp/bat
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A terminal tool that replays Git commits as animated typing sessions with syntax highlighting and file tree transitions.
A minimal, customizable cross-shell prompt written in Rust that shows relevant project and environment info.
A user-friendly interactive command line shell for macOS, Linux and other Unix-like systems, with syntax highlighting and autosuggestions out of the box.
A fast, neofetch-like command-line tool that displays system information alongside a customizable ASCII logo.
A terminal user interface for Git, inspired by Magit, for staging, committing, branching, rebasing and more from the keyboard.