bat is a free command-line tool that shows a file in your terminal the way a code editor would: with syntax colours for the language, line numbers, and marks in the margin for lines you have added or changed since your last git commit. Type bat followed by a file name instead of cat and long files open in a scrollable pager automatically.
It earns its place because it is a drop-in upgrade you stop noticing: when you pipe its output into another command or a file, it behaves exactly like plain cat. It colours over 100 languages and file formats out of the box, comes with a choice of themes, can show hidden characters such as tabs and line endings with -A, and is the usual previewer for fzf, so file pickers show coloured previews.
bat is written in Rust, started by David Peter (sharkdp) and kept up by a team of maintainers, and is dual-licensed under MIT or Apache 2.0. It has about 61,000 stars and around 500 contributors. The latest release is 0.26.1 from 2 December 2025, and the code is still updated regularly.
- Repository: github.com/sharkdp/bat
- Licence: Apache-2.0 (Apache License 2.0)
- Language: Rust. Stars: 61.3K. Forks: 2,365. Last push: Nov 16, 2026.
- Scan: safe, Nov 16, 2026, commit fbd9a41
Who it is for
Developers, sysadmins, students reading config files and anyone who looks at text files in a terminal. It works on macOS, Linux and Windows from a terminal.
Getting started
1. Install on macOS or Linux with Homebrew
brew install bat2. Or on Windows, with winget
winget install sharkdp.bat3. Or on Ubuntu and Debian (older releases name the command batcat)
sudo apt install bat4. Show a file with colours and line numbers
bat README.md5. Try the themes on a file, then set one with --theme or in the config file
bat --list-themesPackage managers install a single program and change nothing else. If you want bat whenever you type cat, add alias cat='bat --paging=never' to your shell config yourself. Our scan covers the source code, not the prebuilt binaries.
Safety scan
We cloned sharkdp/bat at commit fbd9a41 on Nov 16, 2026 and ran the checks described on the GitHub Tools page: credential patterns, decode-and-execute code, install-time scripts, committed binaries, risky CI workflows, every host the code talks to, known vulnerabilities in pinned dependencies, and project hygiene. A person read every hit. This is what we found.
- 0 secret hits across 920 files and about 57,000 lines, roughly 19,000 of them Rust; much of the rest is sample files in many languages for the colouring tests. The 4 committed binaries are expected: assets/syntaxes.bin, themes.bin and acknowledgements.bin are the compiled colour definitions and licence texts built into the program by assets/create.sh from the files beside them, and the fourth is a UTF-16 PowerShell test file.
- 1 pattern hit, a test in tests/integration_tests.rs that checks bat prints control characters correctly by writing them as hex escapes.
- No install script. Releases are single prebuilt binaries, usually installed through Homebrew, winget, Chocolatey, Scoop or apt.
- 47 advisories, but 42 of them, including all 3 critical and 28 high, are for an old GitPython listed in tests/syntax-tests/source/Requirements.txt/requirements.txt, a sample file bat colours in its tests and never installs. The 5 in the program's own Cargo.lock are 4 notices that a library is no longer maintained (bincode, two YAML libraries and a macro helper) and one memory-correctness bug in rustix, none rated.
- The program contacts no server: it reads git status from your local repository. Two workflows, no pull_request_target; 1 of 8 third-party actions is pinned to a commit. A security policy and Dependabot are present, no CodeQL. OpenSSF Scorecard gives it 5.5 out of 10.
What the scanner counted
| Check | Result |
|---|---|
| Secrets | None found. |
| Suspicious code | 1 pattern hit found and read; every one is listed under the raw findings. |
| Install-time code | None: nothing runs at install beyond the package manager itself. |
| Committed binaries | 4 executable or compiled objects committed; listed under the raw findings. |
| CI workflows | 2 workflows. None use pull_request_target. 7 of 8 third-party actions pinned to a tag rather than a commit. |
| Network hosts | 36 distinct hosts referenced from source; most often github.com, developer.mozilla.org, dom.spec.whatwg.org, webkit.org. No URLs to bare IP addresses. |
| Known vulnerabilities | 47 advisories across 308 pinned packages: 3 critical, 28 high, 10 moderate, 1 low, 5 unrated. Cargo.lock: 293 packages, 5 advisories; tests/syntax-tests/source/Go/go.mod: 1 packages, 0 advisories; tests/syntax-tests/source/Requirements.txt/requirements.txt: 14 packages, 42 advisories. |
| Project hygiene | Has security policy, automated dependency updates, contributing guide. Missing CodeQL, licence file. |
| OpenSSF Scorecard | 5.5 out of 10, as of Nov 2, 2026. |
The raw findings
Every hit the scanner wrote out, with a link to the exact line at the scanned commit. Secrets candidates are redacted.
Pattern hits (1)
| Where | Rule | Match |
|---|---|---|
| tests/integration_tests.rs:3801 | long-hex-escape-run (test/example) | .stdout("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\x7F") |
Committed binaries (4)
assets/syntaxes.bin: .bin, 1 MBassets/themes.bin: .bin, 58 KBassets/acknowledgements.bin: .bin, 17 KBtests/syntax-tests/source/PowerShell/test.ps1: .ps1, 1 KB
Worst known vulnerabilities (24 of 47)
| Advisory | Severity | Package | Summary |
|---|---|---|---|
| GHSA-284h-m62q-gf8w | critical | gitpython@3.0.7 | GitPython: Dormant multi-line git-config values are corrupted into live injected directives (e.g. core.hooksPath) on any… |
| GHSA-hcpj-qp55-gfph | critical | gitpython@3.0.7 | GitPython vulnerable to Remote Code Execution due to improper user input validation |
| GHSA-pr76-5cm5-w9cj | critical | gitpython@3.0.7 | GitPython vulnerable to remote code execution due to insufficient sanitization of input arguments |
| GHSA-239g-whfq-7xj9 | high | gitpython@3.0.7 | GitPython: Repository content can impersonate the git directory, leading to arbitrary code execution |
| GHSA-23mf-xhv8-69c2 | high | gitpython@3.0.7 | GitPython: arbitrary file read via attacker-controlled branch name in `Head.checkout()` (incomplete fix of CVE-2026-7867… |
| GHSA-2f96-g7mh-g2hx | high | gitpython@3.0.7 | GitPython: Command Injection via git long-option prefix abbreviation bypass of CVE-2026-42215 blocklist |
| GHSA-2mqj-m65w-jghx | high | gitpython@3.0.7 | Untrusted search path under some conditions on Windows allows arbitrary code execution |
| GHSA-3f7w-8rr8-f37f | high | gitpython@3.0.7 | GitPython: Unguarded git option forwarding in IndexFile.checkout() and TagReference.create() enables arbitrary file over… |
| GHSA-3rp5-jjmw-4wv2 | high | gitpython@3.0.7 | GitPython: git-config section-name injection enables arbitrary config directives (core.sshCommand RCE) |
| GHSA-4gmw-gg2m-w46p | high | gitpython@3.0.7 | GitPython: Unguarded git read-tree option forwarding in IndexFile.from_tree/reset/merge_tree enables arbitrary file over… |
| GHSA-6p8h-3wgx-97gf | high | gitpython@3.0.7 | GitPython: Incomplete unsafe_git_clone_options denylist omits --template enabling arbitrary command execution via clone … |
| GHSA-7545-fcxq-7j24 | high | gitpython@3.0.7 | GitPython reference APIs has a path traversal vulnerability that allows arbitrary file write and delete outside the repo… |
| GHSA-7833-fr7j-v32q | high | gitpython@3.0.7 | GitPython: Arbitrary local file content disclosure via [include] directive in untrusted .gitmodules (SubmoduleConfigPars… |
| GHSA-83vg-56qc-22m7 | high | gitpython@3.0.7 | GitPython validates a submodule's ".git" path only after cloning into it (RCE) |
| GHSA-8mcc-hrx5-hvxc | high | gitpython@3.0.7 | GitPython: clone_from()/clone() omit --separate-git-dir from unsafe_git_clone_options, enabling arbitrary git-directory … |
| GHSA-94p4-4cq8-9g67 | high | gitpython@3.0.7 | GitPython: Environment-variable exfiltration via Repo.create_remote() / Remote.add() URL (incomplete fix of GHSA-rwj8-pg… |
| GHSA-956x-8gvw-wg5v | high | gitpython@3.0.7 | GitPython: command injection via unguarded Git options in `Repo.archive()`, `git.ls_remote()`, and arbitrary file overwr… |
| GHSA-9rj7-rf2p-w77r | high | gitpython@3.0.7 | GitPython: Unguarded git option forwarding in Repo.init enables arbitrary command execution via --template clone hooks |
| GHSA-fjr4-x663-mwxc | high | gitpython@3.0.7 | GitPython: Arbitrary file overwrite via git diff --output argument injection in Diffable.diff (key- and value-controlled… |
| GHSA-g5vv-9gxw-82hx | high | gitpython@3.0.7 | GitPython: Denial of Service via catastrophic backtracking (ReDoS) in Actor.name_email_regex - commit author/committer f… |
| GHSA-hmq2-w58f-27jc | high | gitpython@3.0.7 | GitPython: Arbitrary Git Repository Creation Outside the Working Tree via Unvalidated .gitmodules Submodule Name in GitP… |
| GHSA-jm78-9fvv-mhgr | high | gitpython@3.0.7 | GitPython: git-config OPTION-name injection via =/#/whitespace bypasses name validator, enabling forged core.sshCommand/… |
| GHSA-m64x-33q8-m5h7 | high | gitpython@3.0.7 | GitPython parse_actor_and_date() is vulnerable to quadratic backtracking on malformed identity lines |
| GHSA-mv93-w799-cj2w | high | gitpython@3.0.7 | GitPython: Newline injection in config_writer() section parameter bypasses CVE-2026-42215 patch, enabling RCE via core.h… |
By the numbers
| Stars | 61.3K |
|---|---|
| Forks | 2,365 |
| Contributors | 516 |
| Commits | 4,182 |
| Open issues | 332 |
| Open pull requests | 233 |
| Releases | 43 |
| Latest release | v0.26.1 |
| Licence | Apache-2.0 |
| Main language | Rust |
| Project age | 8 years |
| Last push | Nov 16, 2026 |
| Tracked files | 920 |
| Lines of code | 57.3K |
| Checkout size | 8 MB |
Lines by language: Rust 19.2K, JavaScript 10.6K, Markdown 10.3K, Python 9,076, Shell 1,833, C 731.
Questions
Is bat free?
Yes. It is free and open source, dual-licensed under MIT or Apache 2.0, with no paid version.
bat or cat?
bat for reading files yourself: colours, line numbers, git marks and paging. cat is still fine in scripts, and bat acts just like cat when its output goes to another program.
Does bat work on Windows?
Yes. Install it with winget, Chocolatey or Scoop and run it in PowerShell or Windows Terminal. Paging uses less: the Chocolatey package installs it, or turn paging off with --paging=never.
Does bat send my data anywhere?
No. It reads files and local git information on your computer and prints them in your terminal. We found no network code.
How do I uninstall bat?
Use the same package manager you installed it with: brew uninstall bat, winget uninstall sharkdp.bat or sudo apt remove bat. Remove any cat alias you added.
This post is part of GitHub Tools, where every repository is cloned and scanned before it is written up. The scan is a snapshot of one commit on one day; the repository has moved on since, so check it before you install.
