The standard Unix utilities cat and ls were designed over 50 years ago for teleprinters and low-bandwidth serial lines. While ubiquitous, they lack syntax highlighting, Git repository awareness, and modern directory visualization. The modern command-line renaissance has produced two indispensable Rust-powered replacements: bat (a cat clone with syntax highlighting and Git integration) and eza (the maintained, high-performance successor to exa).
Why Developers Alias bat and eza
- bat: Beyond syntax highlighting for over 200 programming languages, bat displays line numbers, highlights git additions/modifications in the gutter, and automatically pages long files through
lesswhile preserving terminal pipe transparency when output is redirected. - eza: Adds multi-column color formatting, human-readable file sizes, symlink resolution, full recursive tree listing (replacing the separate
treeutility), and displays real-time Git status flags (staged, modified, untracked) next to each file.
Tool Capability Comparison Matrix
| Capability | bat vs cat | eza vs ls |
|---|---|---|
| Syntax Highlighting | Yes (syntect engine) vs None | N/A |
| Git Status Integration | Gutter indicators for modified lines | Displays modified/staged/untracked flags |
| Recursive Tree View | N/A | Built-in --tree with depth limits |
| Pipe Transparency | Disables formatting automatically when piped | Falls back to plain text when not a TTY |
Recommended Shell Aliases
Add these aliases to your ~/.zshrc or ~/.bashrc:
# Replace ls with eza
alias ls="eza --icons --group-directories-first"
alias ll="eza -lh --icons --git --group-directories-first"
alias lt="eza --tree --level=2 --icons"
# Replace cat with bat
alias cat="bat --paging=never"
alias preview="bat"
- Ubuntu/Debian batcat Quirk: On Debian and Ubuntu, the
batpackage installs asbatcatdue to a name conflict with another package. Create a symlink:mkdir -p ~/.local/bin && ln -s /usr/bin/batcat ~/.local/bin/bat. - Install eza: On macOS run
brew install eza bat. On Ubuntu, use the official GPG repository fromeza-community/eza.
Conclusion
Replacing legacy POSIX defaults with bat and eza provides immediate visual clarity, reduces cognitive load, and transforms everyday terminal file inspection.
- bat GitHub Repository — Manual, syntax themes, and configurations.
- eza GitHub Repository — Features, installation guides, and release notes.
Discussion & Issues
Comments
Post a Comment