A cat clone with syntax highlighting and Git integration for viewing files in the terminal
bat is a command-line file viewer that replaces the traditional cat command with enhanced functionality. It provides syntax highlighting for a large number of programming and markup languages, making code and configuration files easier to read in the terminal. The tool automatically detects file types and applies appropriate color schemes.
The tool integrates directly with Git to display file modifications in the left sidebar, showing which lines have been added, modified, or deleted compared to the Git index. This makes it useful for quickly reviewing changes during development workflows. bat also includes automatic paging for large files, piping output to less when content exceeds the screen size.
Additional features include displaying non-printable characters with the -A flag, line numbering, and seamless integration with other command-line tools like fzf, ripgrep, and tail. It can serve as a drop-in replacement for cat in most scenarios, automatically falling back to plain text output when piped to other processes or files. The tool supports customization through configuration files and works well as a colorizing pager for man pages and help text.
# via APT
sudo apt install bat
# via Pacman
pacman -S bat
# via DNF
dnf install bat


