Modern Linux CLI Replacements (ripgrep, fzf, eza, bat, zoxide) Master Cheat Sheet
A definitive transition guide and command-line reference for modern, Rust-powered Linux CLI utilities. Replace legacy grep with ripgrep (rg), ls with eza, cat with bat, cd with zoxide, and find with fzf to multiply your terminal productivity and search velocity.
1. The Modern CLI Revolution: Legacy Unix vs Modern Rust Tools Matrix
.gitignore rules, UTF-8 unicode encoding, and interactive terminal interfaces.
Over the past decade, the systems programming language Rust has sparked a renaissance in command-line tooling. By combining zero-cost abstractions, multi-threaded directory traversal, SIMD vectorization, and memory safety, these modern replacements execute orders of magnitude faster while providing human-centric defaults like syntax highlighting and fuzzy filtering.
The following master comparison table maps legacy Unix commands to their modern drop-in successors:# Ubuntu / Debian (24.04 LTS+)
sudo apt update && sudo apt install -y ripgrep fzf bat zoxide
# Note: On Ubuntu, bat is installed as 'batcat'; create an alias: alias bat="batcat"
# Install eza via official gpg keyring or cargo:
sudo mkdir -p /etc/apt/keyrings
wget -qO- https://raw.githubusercontent.com/eza-community/eza/main/deb.asc | sudo gpg --dearmor -o /etc/apt/keyrings/gierens.gpg
echo "deb [signed-by=/etc/apt/keyrings/gierens.gpg] http://deb.gierens.de stable main" | sudo tee /etc/apt/sources.list.d/gierens.list
sudo apt update && sudo apt install -y eza
# Arch Linux
sudo pacman -S ripgrep fzf eza bat zoxide
# macOS (Homebrew)
brew install ripgrep fzf eza bat zoxideInstall the complete modern developer suite with your native package manager.
| Legacy Command | Modern Replacement | Core Architectural Advantage | Default Behavior Upgrade | Copy |
|---|---|---|---|---|
| grep | ripgrep (rg) | Parallel directory traversal + regex SIMD acceleration | Ignores .gitignore, node_modules, and binary files automatically | |
| ls | eza (formerly exa) | Modern visual aesthetics + Git integration | Displays colored file types, tree hierarchy, and git modification state | |
| cat | bat | Built-in syntax highlighting + paging | Automatic line numbers, git diff gutter indicators, and language detection | |
| cd | zoxide (z) | Frecency-based ranking (Frequency + Recency) | Jump directly to deeply nested directories from anywhere with partial name | |
| find | fzf / fd | Interactive fuzzy filtering + instant discovery | Interactive real-time fuzzy search across millions of file paths |
2. ripgrep (rg): Blazing-Fast Code Search & Pattern Filtering
rg command) is widely considered the gold standard of code searching. It recursively searches your current directory by default, respects your .gitignore and hidden file rules, and leverages finite automaton regex parsing that outperforms GNU grep by up to 10x.
Key ripgrep strengths:
1. Smart Case Sensitivity: Searches case-insensitively by default if your pattern contains only lowercase letters; switches automatically to case-sensitive if you include an uppercase letter.
2. Type Filtering: Restrict searches to specific programming languages (e.g. -t rust, -t ts, -t python) without manually specifying file extension wildcards.
3. Multiline Search: Match patterns spanning across line breaks with the -U (multiline) flag.
4. Fast Replacement Preview: Test regex replacements across thousands of files without modifying disk files using -r 'replacement'.# Search for pattern with smart-casing across TypeScript and Vue files
rg "useToolHistory" -t ts -t vue
# Search including hidden files (.env, .config) but still respecting .gitignore
rg "API_SECRET_KEY" --hidden
# Find pattern and print 2 lines of surrounding context (Before and After)
rg -C 2 "function executeCalculation" src/
# Multiline regex search matching function signature spanning several lines
rg -U "export async function[\s\S]*?\{" src/
# Preview replacing old function calls without touching files
rg "oldLogger\((.*?)\)" -r "newLogger(\$1)"High-velocity code search commands showcasing type filtering, context printing, and replacement previews.
| Flag / Option | Full Syntax | Operational Behavior | Practical Use Case | Copy |
|---|---|---|---|---|
| -i | --ignore-case | Force case-insensitive pattern matching | rg -i "error_handler" | |
| -s | --case-sensitive | Force strict case-sensitive matching | rg -s "UserID" | |
| -t <type> | --type <type> | Filter by file type (e.g. ts, py, html, json) | rg -t py "def calculate" | |
| -T <type> | --type-not <type> | Exclude specific file types from results | rg -T js "deprecated" | |
| -g <glob> | --glob <glob> | Include or exclude specific glob patterns | rg "query" -g "!tests/*" | |
| -C <num> | --context <num> | Show N lines of surrounding code context | rg -C 3 "panic!" | |
| -l | --files-with-matches | Print only filenames containing matches | rg -l "TODO" | xargs wc -l | |
| -F | --fixed-strings | Treat pattern as literal text (no regex parsing) | rg -F "const.string" |
3. fzf: Interactive Fuzzy Finding & Shell Automation Pipelines
Ctrl+R: Search your entire command history with interactive fuzzy filtering.
- Ctrl+T: Fuzzy search files and directories in the current subtree and paste the path into the current prompt.
- Alt+C: Fuzzy search subdirectories and immediately cd into the selected destination.# 1. Interactive Git branch switcher
git checkout $(git branch --all | fzf | tr -d '[:space:]' | sed 's#remotes/origin/##')
# 2. Interactive process killer with multi-select (Tab to mark multiple, Enter to kill)
ps aux | fzf --multi --header="Select processes to kill (Tab to select multiple)" | awk '{print $2}' | xargs -r kill -9
# 3. Interactive ripgrep with live file preview using bat
rg --line-number --no-heading --color=always "" | \
fzf --ansi \
--delimiter : \
--preview 'bat --style=numbers --color=always --highlight-line {2} {1}' \
--preview-window 'up,60%,border-bottom,+{2}+3/3'Interactive workflows converting static terminal commands into real-time interactive search pickers.
| Keybinding / Flag | Trigger Scope | Interactive Action | Productivity Benefit | Copy |
|---|---|---|---|---|
| Ctrl + R | Global Shell | Fuzzy search command history with instant preview | Replaces blind reverse-i-search with searchable list | |
| Ctrl + T | Command Line | Insert selected file path at current cursor position | Eliminates manual path typing and tab completion loops | |
| Alt + C | Directory Traversal | Fuzzy jump into chosen child directory | Instant navigation without knowing exact directory hierarchy | |
| -m / --multi | CLI Flag | Enables multi-selection mode using Tab key | Batch process multiple files or process IDs at once | |
| --preview <cmd> | CLI Flag | Renders dynamic preview pane executing command | Inspect file contents or syntax highlighted code before selection |
4. eza & bat: Syntax Highlighting, Git Trees & Modern Directory Listing
ls and cat present monochromatic outputs with minimal context.
eza enhances directory inspection with:
- Color-coded file types and human-readable file sizes (e.g. 24 MB instead of raw byte counts).
- Integrated Git status tracking (indicating whether files are staged, modified, or untracked directly in the listing).
- Recursive visual tree hierarchies replacing the standalone tree command.
bat enhances file inspection with:
- Built-in syntax highlighting for hundreds of programming and markup languages.
- Git gutter integration displaying modified, added, and removed lines.
- Automatic integration with less for seamless scrolling on large files.# Add the following aliases to your ~/.bashrc or ~/.zshrc:
# eza: Modern directory listing with icons and Git integration
alias ls="eza --icons --group-directories-first"
alias ll="eza -la --icons --git --group-directories-first --time-style=long-iso"
alias lt="eza --tree --level=3 --icons --group-directories-first"
# bat: Syntax highlighted pager and diff viewer
alias cat="bat --paging=never --style=plain"
alias b="bat"
# Use bat as the default colorized manual page viewer
export MANPAGER="sh -c 'col -bx | bat -l man -p'"Drop-in shell aliases upgrading ls and cat without altering your muscle memory.
| Command Combo | Utility | Visual Output Feature | Best Practice Scenario | Copy |
|---|---|---|---|---|
| eza -la --git | eza | Detailed permissions, human size, git status indicators | Standard daily directory inspection | |
| eza --tree --level=2 | eza | Visual folder hierarchy up to 2 levels deep | Exploring newly cloned Git repositories | |
| bat file.json | bat | Syntax-highlighted code output with line numbers | Reading configuration files and API responses | |
| bat --diff file.ts | bat | Highlights uncommitted Git modifications in gutter | Reviewing local file edits before git staging |
Related Free Online Tools
Put these techniques into practice immediately with our privacy-first browser utilities:
Craft and validate complex PCRE and Rust-compatible regular expressions for ripgrep queries.
Decode octal and symbolic file permissions shown in modern eza directory listings.
Test terminal keybindings, modifier combinations, and interactive fzf hotkeys in the browser.