Navigate:
~$BAT0.2%

bat: cat clone with syntax highlighting

Enhanced cat replacement with syntax highlighting and Git integration for file viewing.

LIVE RANKINGS • 11:01 AM • STEADY
OVERALL
#134
54
DEVELOPER TOOLS
#23
9
30 DAY RANKING TREND
ovr#134
·Devel#23
STARS
57.0K
FORKS
1.4K
7D STARS
+117
7D FORKS
+2
See Repo:
Share:

Learn more about bat

bat is a command-line utility written in Rust that functions as an enhanced version of the Unix cat command. It processes text files and applies syntax highlighting based on file extensions or explicit language specifications, while also integrating with Git to display modification indicators. The tool automatically detects terminal capabilities and can pipe output through pagers like less for large files, falling back to plain text output when used in non-interactive contexts. It supports over 200 programming and markup languages and can be integrated into existing workflows as a drop-in replacement for cat.

bat

1

Git Integration

Displays Git modification markers in the sidebar, showing additions, deletions, and changes relative to the repository index.

2

Automatic Paging

Intelligently switches between paged and plain output based on terminal context, maintaining compatibility with pipes and redirects.

3

Non-printable Characters

Visualizes whitespace, control characters, and other non-printable elements with highlighting and special symbols.


# Display a single file with syntax highlighting
bat README.md

# Display multiple files at once
bat src/*.rs

# Concatenate files into a new document
bat header.md content.md footer.md > document.md

# Show line numbers only
bat -n main.rs


vv0.26.1

v0.26.1

  • Add paging to '-h' and '--help' see PR #3478 (@MuntasirSZN)
  • Fix hang when using `--list-themes` with an explicit pager, see #3457 (@abhinavcool42)
  • Fix negative values of N not being parsed in <N:M> line ranges without `=` flag value separator, see #3442 (@lmmx)
  • Fix broken Docker syntax preventing use of custom assets, see #3476 (@keith-hall)
  • Fix diagnostics attempting to find the version of an executable named builtin when builtin pager is used. See #3498 (@keith-hall)
vv0.26.0

v0.26.0

  • Add build for windows/ARM64 platform. #3190 (@alcroito)
  • Add paging to `--list-themes`, see PR #3239 (@einfachIrgendwer0815)
  • Support negative relative line ranges, e.g. `bat -r:-10` / `bat -r='-10:'`, see #3068 (@ajesipow)
  • Support context in line ranges, e.g. `bat -r 30::5` / `bat -r 30:40:5`, see #3345 (@cavanaug)
  • Add built-in 'minus' pager, e.g. `bat --pager=builtin` see PR #3402 (@academician)
vv0.25.0

Use GitHub API to get correct PR submitter #2791 (@cyqsimon)

  • Set terminal title to file names when Paging is not Paging::Never #2807 (@Oliver-Looney)
  • `bat --squeeze-blank`/`bat -s` will now squeeze consecutive empty lines, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815)
  • `bat --squeeze-limit` to set the maximum number of empty consecutive when using `--squeeze-blank`, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815)
  • `PrettyPrinter::squeezeemptylines` to support line squeezing for bat as a library, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815)
  • Syntax highlighting for JavaScript files that start with `#!/usr/bin/env bun` #2913 (@sharunkumar)


[ EXPLORE MORE ]

Related Repositories

Discover similar tools and frameworks used by developers