.dotfiles

Modern CLI Tools Reference

Enhanced replacements for traditional Unix commands

Overview

Modern CLI tools provide significant improvements over traditional Unix utilities:

Tool Replacements

File Operations

Traditional Modern Benefits
ls eza Git integration, tree view, icons
cat bat Syntax highlighting, line numbers, git changes
find fd Intuitive syntax, respect .gitignore, faster
grep ripgrep 10-100x faster, respects .gitignore, better UX
sed sd Intuitive find/replace syntax
diff delta Syntax highlighting, side-by-side view

System Monitoring

Traditional Modern Benefits
top htop Interactive process viewer, tree view
ps procs Better formatting, tree view
df duf Better formatting, device filtering
du dust Intuitive tree view, faster

Network Tools

Traditional Modern Benefits
ping gping Graph visualization
dig dog Colorful output, better UX
curl xh HTTPie-compatible, faster, single binary

Configuration

eza (Enhanced ls)

# Aliases in .zshrc
alias l='eza --group-directories-first --time-style=relative --git --icons --all --header --long'
alias ls='eza --group-directories-first'
alias ll='eza -l --git --time-style=relative'
alias la='eza -a'
alias lt='eza --tree'

bat (Better cat)

# Environment
export BAT_THEME="tokyonight_storm"  # or "tokyonight_day" for light

# Aliases
alias cat='bat'
alias less='bat --paging=always'

ripgrep (Fast grep)

# Config at ~/.config/ripgrep/config
--smart-case
--colors=match:fg:red
--colors=line:fg:yellow

fd (Friendly find)

# Aliases
alias find='fd'
ff() { fd "$@" | fzf }

delta (Git diff)

# In .gitconfig
[core]
    pager = delta

[delta]
    navigate = true
    light = false
    side-by-side = true

Usage Examples

Finding Files

# Traditional
find . -name "*.py" -type f

# Modern
fd -e py

# With preview
fd -e py | fzf --preview 'bat {}'

Searching Text

# Traditional
grep -r "TODO" . --include="*.js"

# Modern
rg "TODO" -t js

# With context
rg "TODO" -C 2

Viewing Files

# Traditional
cat file.py

# Modern with highlighting
bat file.py

# With line numbers
bat -n file.py

Listing Files

# Traditional
ls -la

# Modern with git status
ll

# Tree view
lt --level=2

System Info

# Traditional
df -h

# Modern
duf

# Just local disks
duf --only local

Performance Comparison

ripgrep vs grep

# Test: Search Linux kernel source
time grep -r "TODO" linux/
# 18.5s

time rg "TODO" linux/
# 0.5s (37x faster!)

fd vs find

# Test: Find all Python files
time find . -name "*.py" -type f
# 4.2s

time fd -e py
# 0.3s (14x faster!)

Integration Tips

With fzf

# Interactive file search
alias ff='fd | fzf --preview "bat {}"'

# Interactive grep
fif() {
  rg "$1" | fzf --preview 'bat {1} --highlight-line {2}'
}

With tmux

# Use bat for tmux copy mode
set -g @plugin 'laktak/extrakto'
set -g @extrakto_clip_tool 'pbcopy'

With Git

# Better git log
alias gl='git log --graph --pretty=format:"%C(auto)%h%d %s %C(black)%C(bold)%cr" | delta'

# Interactive branch selection
fco() {
  git branch -a | fzf | xargs git checkout
}

Installation

# macOS with Homebrew
brew install eza bat fd ripgrep sd delta htop duf dust procs gping dog xh fzf

# Configuration
mkdir -p ~/.config/ripgrep
echo "--smart-case" > ~/.config/ripgrep/config

Customization

Color Themes

Most tools respect terminal colors or have theme support:

# Dark mode
export BAT_THEME="tokyonight_storm"
export EZA_COLORS="di=34:ln=35:ex=31"

# Light mode
export BAT_THEME="tokyonight_day"
export EZA_COLORS="di=94:ln=95:ex=91"

Shell Integration

Add to your .zshrc:

# Modern CLI replacements
[ -x "$(command -v eza)" ] && alias ls='eza'
[ -x "$(command -v bat)" ] && alias cat='bat'
[ -x "$(command -v fd)" ] && alias find='fd'
[ -x "$(command -v rg)" ] && alias grep='rg'
[ -x "$(command -v sd)" ] && alias sed='sd'
[ -x "$(command -v htop)" ] && alias top='htop'
[ -x "$(command -v duf)" ] && alias df='duf'

← Back to Commands