A cat clone with syntax highlighting, Git integration, and automatic paging.
bat is a command-line utility that functions as a modern replacement for the traditional `cat` command. It adds syntax highlighting, Git integration, and automatic paging to file viewing, making it easier to read and navigate code and text files in the terminal. It solves the problem of plain text output by providing visual cues and contextual information.
Developers, system administrators, and anyone who frequently works in the terminal and wants enhanced file viewing capabilities. It's particularly useful for those who read code, configuration files, or logs directly from the command line.
Developers choose bat because it seamlessly integrates into existing workflows as a drop-in replacement for `cat`, while offering significant improvements like syntax highlighting and Git awareness. Its focus on performance, compatibility, and ease of use makes it a preferred tool for terminal-based file inspection.
A cat(1) clone with wings.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports a vast array of programming languages with customizable themes, as shown in the syntax highlighting example and the --list-themes option for easy theme switching.
Displays Git modifications in a sidebar, making it easy to see changes at a glance, which is particularly useful for code reviews and version control workflows.
Automatically pipes output to a pager like less for large files but falls back to cat-like behavior when piping to other processes, ensuring compatibility with existing scripts.
Works well with popular command-line tools like fzf, ripgrep, and find, enhancing previews and search results, as demonstrated in the integration examples.
On older Ubuntu/Debian systems, the executable is installed as batcat due to package name clashes, requiring manual aliasing or symlinking, which adds setup complexity.
Only natively handles UTF-8 and UTF-16 encodings; other encodings require external conversion with tools like iconv, as noted in the troubleshooting section.
Requires installing a separate pager like less for proper functionality on Windows, and has issues with Cygwin paths, making it less seamless in some environments.