Skip to content
Go back

cat clone with wings

Published:  at  04:20 PM
1 min read

As a terminal user, I’m pretty sure I use cat command daily.

Today I learned about bat, a cat clone with syntax highlighting and Git integration.

bat logo

Usage

Just add bat before the file/s you want to print

bat syntax highlighting example showing colorful code output

Git integration

bat git integration example showing diff highlighting

bat supports automatic paging, so if your file is too large for the screen it will automatically pipe the output to less.

It can read from stdin and automatically determine the syntax, though you can always specify it explicitly with the -l option.

Installation

on macOS with Homebrew

$ brew install bat

Pro Tips

  1. You can choose your favorite theme, out of the available options (bat --list-themes), using --theme= flag.

    bat DarkNeon theme example showing colorful syntax highlighting

    For more advanced configuration, search for the --style option and its possible values.

  2. Add -A / --show-all flag to highlight non-printable characters




Previous Post
Tmux fpp
Next Post
Conditional Breakpoints