bat is a cat clone with syntax highlighting and Git integration. It enhances file viewing with line numbers, automatic paging, and beautiful themes for over 100 programming languages.
📑 Table of Contents
Key Features
- Syntax Highlighting: Automatic language detection
- Git Integration: Show file modifications
- Line Numbers: Built-in numbering
- Paging: Automatic less integration
- Themes: Multiple color schemes
Installation
Install bat on Ubuntu:
sudo apt install bat
# Note: binary may be named batcat
alias bat="batcat"
Usage Examples
Common bat operations:
# View file with syntax highlighting
bat script.py
# Show line numbers only
bat -n file.txt
# Show non-printable characters
bat -A binary.dat
# Concatenate files
bat header.md content.md footer.md
# Use specific theme
bat --theme="Dracula" code.js
Benefits
bat makes file viewing a pleasure with its visual enhancements. Syntax highlighting and Git integration provide context that plain cat cannot.
Was this article helpful?