Reading source code, JSON configuration payloads, and sprawling Git diffs through standard Linux command-line utilities like cat, less, or default monochrome git diff creates eye strain and slows development workflows. Modern Rust-based CLI tools have revolutionized terminal productivity by introducing rich syntax highlighting, line numbering, Git modification gutters, and side-by-side visual diffing. Combining bat (a cat clone with wings) and delta (a syntax-highlighting pager for git) transforms standard terminals into high-readability developer environments.
Installing bat and delta Across Linux Distributions
Both utilities are available across official repositories and binary packages:
# Ubuntu / Debian
sudo apt update && sudo apt install -y bat
# On Debian/Ubuntu, the binary is named 'batcat' to avoid conflicts with another package.
# Create a symlink to use the standard 'bat' command:
mkdir -p ~/.local/bin
ln -s /usr/bin/batcat ~/.local/bin/bat
# Download and install delta .deb release:
curl -Lo /tmp/git-delta.deb https://github.com/dandavison/delta/releases/latest/download/git-delta_0.17.0_amd64.deb
sudo dpkg -i /tmp/git-delta.deb
# Arch Linux
sudo pacman -S bat git-delta
# Fedora / RHEL
sudo dnf install -y bat git-delta
Leveraging bat for Enhanced File Viewing
Executing bat <filename> automatically detects file extensions and applies syntax highlighting themes:
# View a Python script with line numbers and syntax formatting
bat script.py
# Pipe command outputs directly into bat with explicit syntax parsing
curl -s https://api.github.com/users/octocat | bat -l json
# Display non-printable characters (tabs, spaces, carriage returns)
bat -A config.yaml
Key advantages of bat over standard cat include:
- Git Integration: Displays colored plus (
+) and minus (-) indicators in the left margin gutter showing uncommitted Git modifications against the index. - Automatic Paging: Automatically pipes output through
lessif the content exceeds the current terminal window height. - Themes: Choose from dozens of built-in palettes (such as Dracula, Monokai, or Nord) via
bat --theme="Dracula" <file>.
Configuring delta as the Default Git Pager
To replace standard unformatted Git diffs with syntax-highlighted, word-level inline difference tracking:
- Open your global Git configuration:
git config --global core.pager "delta" git config --global interactive.diffFilter "delta --color-only" - Fine-tune delta styling by editing
~/.gitconfig:[delta] navigate = true # use n and N to move between diff sections light = false # set to true if using light terminal backgrounds line-numbers = true side-by-side = true syntax-theme = Dracula - Test the configuration inside any local Git repository:
git diff git show HEAD git log -p -n 1
With side-by-side = true, delta renders changes in dual parallel columns with granular intra-line character highlights, making code reviews within terminal environments significantly faster.