Back to Resources Resource

Modern CLI Toolkit - Replace Your Old Unix Commands

bat, ripgrep, eza, and zoxide - the Rust-powered replacements that are faster and more user-friendly than cat, grep, ls, and cd.

The classic Unix commands - cat, grep, ls, cd - were designed decades ago. They work, but they're showing their age: no syntax highlighting, slow searches, ugly output, no smart navigation. Modern CLI tools built in Rust replace them with faster, prettier, and smarter alternatives.

🦀

Rust-Powered Speed

bat, ripgrep, eza, and zoxide are written in Rust - they're faster than your old tools and come with modern features like syntax highlighting and smart defaults.

Old vs New: Side by Side

See the difference between classic Unix commands and their modern replacements:

OLD: cat output.json { "name": "John Doe", "email": "john@example.com", "age": 28, "active": true, "roles": ["admin", "user"] } OLD: ls -la drwxr-xr-x user 4096 Jan 15 src -rw-r--r-- user 1234 Jan 14 README.md -rw-r--r-- user 567 Jan 14 package.json drwxr-xr-x user 4096 Jan 13 node_modules -rw-r--r-- user 890 Jan 12 .gitignore NEW: bat output.json 1 2 3 4 5 6 7 { "name": "John Doe", "email": "john@example.com", "age": 28, "active": true, "roles": ["admin", "user"] } NEW: eza -la --icons 📁 src 4.0K 15 Jan 10:30 📖 README.md 1.2K 14 Jan 09:15 📦 package.json 567B 14 Jan 09:10 📁 node_modules -- 13 Jan 08:00 🚫 .gitignore 890B 12 Jan 14:20 Plain, boring, hard to read Colorful, icons, human-readable

Classic commands (left) vs modern replacements (right) - syntax highlighting, icons, and human-readable output

Key Features

🦇

bat

cat with syntax highlighting, line numbers, and git integration. Makes reading code beautiful.

🔍

ripgrep

grep but 10x faster. Respects .gitignore, searches recursively by default, smart case sensitivity.

📂

eza

ls with icons, colors, tree view, and git status. Makes directory listings beautiful and informative.

zoxide

cd that learns your habits. Jump to any directory with just a few characters. No more typing long paths.

Practical Examples

Here's how to use each tool and set them up as replacements:

bat - Better cat

# Install
brew install bat  # macOS
apt install bat   # Ubuntu (may be 'batcat')

# Usage - syntax highlighting for any file
bat README.md
bat src/app.tsx

# Show line numbers and git changes
bat --style=numbers,changes main.py

# Use as pager for man pages
export MANPAGER="sh -c 'col -bx | bat -l man -p'"

# Alias to replace cat
alias cat="bat --paging=never"

ripgrep (rg) - Better grep

# Install
brew install ripgrep  # macOS
apt install ripgrep   # Ubuntu

# Basic search - recursive by default!
rg "TODO"

# Search specific file types
rg "useState" -t tsx
rg "def " -t py

# Case insensitive
rg -i "error"

# Show context lines
rg "function" -C 3

# Search and replace preview
rg "oldName" --replace "newName"

# Alias to replace grep
alias grep="rg"

eza - Better ls

# Install
brew install eza  # macOS
apt install eza   # Ubuntu 22.10+

# List with icons and colors
eza --icons

# Long format with git status
eza -la --git --icons

# Tree view
eza --tree --level=2 --icons

# Sort by modified time
eza -l --sort=modified

# Recommended aliases
alias ls="eza --icons"
alias ll="eza -la --icons --git"
alias tree="eza --tree --icons"

zoxide - Better cd

# Install
brew install zoxide  # macOS
apt install zoxide   # Ubuntu

# Add to your .zshrc or .bashrc
eval "$(zoxide init zsh)"  # or bash/fish

# Now use 'z' instead of 'cd'
z projects    # jumps to ~/Documents/projects
z myapp       # jumps to ~/code/myapp
z src         # jumps to most visited src folder

# Interactive selection with fzf
zi            # fuzzy search all directories

# Replace cd entirely
alias cd="z"

Comparison Table

Quick reference for old commands vs new replacements:

Old Command New Command Key Benefits
cat file.js bat file.js Syntax highlighting, line numbers, git diff markers
grep -r "text" . rg "text" 10x faster, respects .gitignore, recursive by default
ls -la eza -la --icons Icons, colors, git status, tree view
cd ~/long/path/here z here Learns frecency, jump with partial names
find . -name "*.js" fd -e js Simpler syntax, faster, colorized output
du -sh * dust Visual bar chart, sorted output, much faster

Why Developers Love It

  • Blazingly Fast - Rust-powered tools are often 10-100x faster than their predecessors.
  • Beautiful Output - Colors, icons, and smart formatting make terminal work enjoyable.
  • Sensible Defaults - rg respects .gitignore, bat shows line numbers, eza has colors on by default.
  • Drop-in Replacements - Alias them and your muscle memory still works.
  • Active Development - New features and improvements added regularly.

Cheatsheet

Quick reference for common operations:

Task Command Description
View file bat file.py Syntax highlighted with line numbers
Search code rg "pattern" Fast recursive search
Search type rg "fn" -t rust Search only Rust files
List files eza -la --icons Long format with icons
Tree view eza --tree -L 2 2-level directory tree
Smart jump z project Jump to frequently used directory
Interactive jump zi Fuzzy search directories
Find files fd pattern Fast file finder (bonus tool)

Pro Tips

Advanced configurations and tips for power users:

🎨

Configure bat Theme

Run bat --list-themes to see options. Set with export BAT_THEME="Dracula" in your shell config.

📝

ripgrep Config File

Create ~/.ripgreprc with default options. Set export RIPGREP_CONFIG_PATH=~/.ripgreprc. Add flags like --smart-case.

🗂️

eza with Git Status

Use eza -la --git to see which files are modified, staged, or untracked right in your directory listing.

🧠

zoxide Query Syntax

Multiple keywords narrow down: z code react matches ~/code/react-app. Use z - to go back to previous directory.

📦

Complete Shell Config

Add all aliases at once to your .zshrc: alias cat="bat" ls="eza --icons" grep="rg" and eval "$(zoxide init zsh)"

🔗

Combine Tools

Use them together: rg "TODO" | bat -l log or fd -e py | fzf --preview 'bat {}'

Getting Started

  1. 1

    Install All Tools

    macOS: brew install bat ripgrep eza zoxide fd

  2. 2

    Add Aliases to Shell Config

    Add to ~/.zshrc: alias cat="bat" ls="eza --icons" grep="rg"

  3. 3

    Initialize zoxide

    Add to ~/.zshrc: eval "$(zoxide init zsh)"

  4. 4

    Reload and Enjoy

    Run source ~/.zshrc and experience the modern terminal

Modernize Your Terminal Today

Stop using tools from the 1970s. Install the modern CLI toolkit and enjoy a faster, prettier terminal experience.

Explore More Resources