📝 Edit page
➕ Add page
bat
a
cat
clone with wings
See GitHub repo
Benefits
- Supports syntax highlighting
- It communicates with Git to show modifications
Usage
See How to use in the docs.
Basic file viewing
View the contents of a file with syntax highlighting.
$ bat filename
View multiple files
View the contents of multiple files, each with syntax highlighting.
$ bat file1 file2 file3
Line numbering
Display line numbers alongside the file contents.
$ bat -n filename
Show non-printable characters
Show non-printable characters like tabs and newlines.
$ bat -A filename
Paging with less
Use less
for paging through the file contents.
$ bat --paging=always filename
Compare file versions
Compare multiple file versions side by side.
$ bat --diff file1 file2
Highlight specific lines
Highlight specific lines in the file, for example, lines 10 to 20.
$ bat --highlight-line 10:20 filename
Customize theme
Specify a theme for syntax highlighting.
$ bat --theme="TwoDark" filename
List available themes
List all available themes for syntax highlighting.
$ bat --list-themes
Display plain text
Display the file contents without syntax highlighting.
$ bat --plain filename
Show file header
Show a header with the file name and metadata.
$ bat --style=header filename