The bat utility is a modern, enhanced clone of the traditional cat command written in Rust that incorporates syntax highlighting for hundreds of programming languages, Git change integration, and automatic paging. In newly deployed minimal Linux installations, container base images, or remote VPS servers, running bat returns bash: bat: command not found because the binary is not part of default Linux core distributions, or because Debian-based systems package it under the alternative executable name batcat.
Create Symlink for Debian and Ubuntu Installations (batcat)
On Debian, Ubuntu, and Raspberry Pi OS, the package manager installs the binary as batcat to avoid naming collisions with an existing system package:
# Install bat package via APT
sudo apt update && sudo apt install -y bat
# Create user symlink to enable the standard bat command
mkdir -p ~/.local/bin
ln -s /usr/bin/batcat ~/.local/bin/bat
# Ensure ~/.local/bin is in your PATH
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
# Verify installation
bat --version
Install via Pre-Compiled Static Binary
For minimal container environments without package managers, download the official pre-compiled release binary:
# Download latest bat archive for Linux x86_64
curl -sSL https://github.com/sharkdp/bat/releases/latest/download/bat-v0.24.0-x86_64-unknown-linux-musl.tar.gz -o /tmp/bat.tar.gz
# Extract binary directly into system bin
sudo tar -xzf /tmp/bat.tar.gz -C /usr/local/bin/ --strip-components=1
# Ensure executable execution permissions
sudo chmod +x /usr/local/bin/bat
# Clean up archive
rm -f /tmp/bat.tar.gz
# Verify installation
bat --version
Install on Other Linux Distributions
Package managers on modern distributions provide bat directly under its primary name:
# On Arch Linux:
sudo pacman -S bat
# On Alpine Linux:
apk add bat
# On systems with Homebrew:
brew install bat