bat CLI

bat is a source-viewing CLI that marks Git changes and reveals whitespace and non-printable characters around an error.

  • 61,109 ★ on the repository
  • Last commit
  • Apache-2.0
CLI

Extended access

Why this level

  • The viewer reads selected files and passes text to the configured pager.
All reasons and checks

sharkdp/bat

Install

Manual install

sudo apt install bat

First README installation method for Ubuntu/Debian. Some releases name the command batcat.

Access and checks

How we review

Extended accessThe tool runs code or makes network calls and only reads external data.

  • The viewer reads selected files and passes text to the configured pager.

This is third-party code. Review the repository files before installing.

What it does

bat is a terminal viewer that displays files with language highlighting and line numbers. In a Git project it marks changes relative to the index, helping reviewers locate relevant code. Long files can open in a pager. It reads individual files, combines files and accepts standard input. When output is redirected to another process, it automatically emits plain content without decoration. Scripts can use that output with other terminal tools.

Who it is for. Programmers reading source files and reviewing changed lines directly in the terminal.

Good fit when

  • A file needs line-numbered, syntax-highlighted inspection before editing.
  • You want to identify changes relative to the Git index.
  • A problem involves whitespace or control characters hidden by ordinary output.
  • Another command’s JSON output needs highlighted inspection.

Not a fit when

  • You need to search for matches across an entire repository.
  • The task is editing and saving a file.
  • You are working with a complex Office document that needs a dedicated parser.

Example request

Show this file with line numbers and inspect non-printable characters near the failing line.

Limitations

Some Ubuntu and Debian releases name the executable batcat; use that name in commands and scripts. Long files viewed in a terminal may open in a pager that waits for keyboard input. Text arriving through standard input sometimes needs an explicit language for suitable highlighting. Git markers show changes against the current repository index, so comparing other versions or branches requires a separate diff.

How to disable. Exit the pager and uninstall bat through the same package manager. Restore any cat alias separately.

FAQ

Why is bat missing after installation?

Some packages name the executable `batcat`. Run `batcat --version`; if it returns a version, use that command name.

How do I disable paging?

Use `--paging=never` so output does not wait for pager interaction.

How do I hide the grid and header but keep line numbers?

Use `bat -n main.rs`, replacing the path with your file. The output keeps line numbers without the grid and header.

How do I reveal non-printable characters?

Add `-A` or `--show-all` to inspect whitespace and control characters around an error.

Will redirected output include color formatting?

By default, bat detects redirection and emits undecorated text. If a file contains color codes, look for a setting that forces color output.

Discussion

No questions or reviews yet.

CLI tools

The CLI replays Git changes as typing animations to present commits and working-tree edits in the terminal.

CLIMinimal access5.3KRepository stars

lazygit is a terminal Git interface for bisecting regressions: mark good and bad revisions while locating the faulty commit.

CLIExtended access83.7KRepository stars

GitUI is a terminal Git interface that runs operations asynchronously, keeping the interface responsive during Git work.

CLIExtended access22.6KRepository stars

A CLI turns Git changes into a guided code walkthrough with questions and explanations written by your existing agent

CLIExtended access363Repository stars

sad is a text-replacement CLI with literal matching: dots and parentheses can be searched as characters without regex syntax.

CLIExtended access2.1KRepository stars

broot is a terminal file manager that calculates directory sizes in the background to show large folders before cleanup.

CLIExtended access13.1KRepository stars

README in short

Themes and visible decoration components are configurable. bat can serve as a previewer alongside file-search and selection tools.

README badge

Report a problem

Foxx AIbat
Foxx AI

I am Foxx AI and I have already vetted this tool. Ask about install, setup or anything else, and I will keep it simple.