Command Line Productivity Tools - Complete Guide
Published: September 25, 2024 | Reading time: 18 minutes
Essential CLI Tools
Transform your command line experience with these powerful productivity tools:
Tool Categories
# File Operations
- exa (modern ls)
- bat (better cat)
- fd (fast find)
- ripgrep (fast grep)
# Navigation & Search
- fzf (fuzzy finder)
- zoxide (smart cd)
- broot (tree navigation)
# Development
- git-delta (better git diff)
- lazygit (git TUI)
- gitui (git interface)
File Operations Tools
exa - Modern ls Replacement
Installation
# macOS
brew install exa
# Ubuntu/Debian
sudo apt install exa
# Arch Linux
sudo pacman -S exa
# Cargo (Rust)
cargo install exa
# Verify installation
exa --version
Basic Usage
# Basic listing
exa
# Long format with details
exa -l
# Tree view
exa --tree
# Show hidden files
exa -a
# Sort by modification time
exa -l --sort=modified
# Show file sizes in human readable format
exa -lh
# Color output
exa --color=always
# Git status integration
exa --git
bat - Better cat
Installation
# macOS
brew install bat
# Ubuntu/Debian
sudo apt install bat
# Arch Linux
sudo pacman -S bat
# Cargo (Rust)
cargo install bat
# Verify installation
bat --version
Basic Usage
# View file with syntax highlighting
bat file.txt
# Show line numbers
bat -n file.txt
# Show non-printable characters
bat -A file.txt
# Plain text output (no highlighting)
bat --plain file.txt
# Multiple files
bat file1.txt file2.txt
# Pipe input
echo "Hello World" | bat
# Custom theme
bat --theme=Dracula file.txt
# Show all themes
bat --list-themes
fd - Fast find
Installation
# macOS
brew install fd
# Ubuntu/Debian
sudo apt install fd-find
# Arch Linux
sudo pacman -S fd
# Cargo (Rust)
cargo install fd-find
# Verify installation
fd --version
Basic Usage
# Find files by name
fd "config"
# Find files by extension
fd -e js
# Find files by type
fd -t f # files only
fd -t d # directories only
# Case insensitive search
fd -i "CONFIG"
# Search in specific directory
fd "test" src/
# Exclude directories
fd --exclude node_modules "test"
# Show absolute paths
fd -a "config"
# Execute command on results
fd -e js -x echo "Found: {}"
# Limit results
fd "test" --max-results 10
Search and Text Processing
ripgrep - Fast grep
Installation
# macOS
brew install ripgrep
# Ubuntu/Debian
sudo apt install ripgrep
# Arch Linux
sudo pacman -S ripgrep
# Cargo (Rust)
cargo install ripgrep
# Verify installation
rg --version
Basic Usage
# Search for text
rg "function"
# Case insensitive search
rg -i "FUNCTION"
# Search in specific file types
rg -t js "console.log"
# Exclude file types
rg -T js "function"
# Show context lines
rg -C 3 "error"
# Show only filenames
rg -l "TODO"
# Show line numbers
rg -n "function"
# Use regex
rg "function\s+\w+"
# Search in specific directory
rg "import" src/
# Exclude directories
rg --glob '!node_modules' "test"
Navigation Tools
fzf - Fuzzy Finder
Installation
# macOS
brew install fzf
# Ubuntu/Debian
sudo apt install fzf
# Arch Linux
sudo pacman -S fzf
# Manual installation
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
# Verify installation
fzf --version
Basic Usage
# Interactive file finder
fzf
# Search files
find . -type f | fzf
# Search with preview
fzf --preview 'cat {}'
# Search with bat preview
fzf --preview 'bat --color=always {}'
# Search with exa preview
fzf --preview 'exa -l {}'
# Multiple selection
fzf -m
# Search history
history | fzf
# Search processes
ps aux | fzf
# Search git commits
git log --oneline | fzf
zoxide - Smart cd
Installation
# macOS
brew install zoxide
# Ubuntu/Debian
sudo apt install zoxide
# Arch Linux
sudo pacman -S zoxide
# Cargo (Rust)
cargo install zoxide
# Initialize in shell
echo 'eval "$(zoxide init bash)"' >> ~/.bashrc
echo 'eval "$(zoxide init zsh)"' >> ~/.zshrc
# Verify installation
zoxide --version
Basic Usage
# Smart directory jumping
z project-name
# Jump to most frequent directory
z
# Jump to directory with highest score
z -t
# List all directories with scores
z -l
# Add current directory
zoxide add .
# Remove directory from database
zoxide remove /path/to/dir
# Query without jumping
zoxide query project-name
Development Tools
git-delta - Better git diff
Installation
# macOS
brew install git-delta
# Ubuntu/Debian
sudo apt install git-delta
# Arch Linux
sudo pacman -S git-delta
# Cargo (Rust)
cargo install git-delta
# Configure git to use delta
git config --global core.pager delta
git config --global interactive.diffFilter 'delta --color-only'
# Verify installation
delta --version
Configuration
# Git configuration for delta
git config --global core.pager delta
git config --global interactive.diffFilter 'delta --color-only'
# Delta configuration
git config --global delta.navigate true
git config --global delta.side-by-side true
git config --global delta.line-numbers true
git config --global delta.syntax-theme Dracula
# Show whitespace
git config --global delta.show-syntax-theme true
git config --global delta.show-colors true
# Merge conflict style
git config --global delta.merge-conflict-style diff3
lazygit - Git TUI
Installation
# macOS
brew install lazygit
# Ubuntu/Debian
sudo apt install lazygit
# Arch Linux
sudo pacman -S lazygit
# Go install
go install github.com/jesseduffield/lazygit@latest
# Verify installation
lazygit --version
Basic Usage
# Launch lazygit
lazygit
# Open in specific directory
lazygit -p /path/to/repo
# Open in current directory
lazygit .
# Key bindings:
# q - quit
# h/j/k/l - navigation
# space - stage/unstage
# c - commit
# p - push
# P - pull
# r - refresh
# s - stash
# S - stash pop
System Monitoring
htop - Better top
Installation
# macOS
brew install htop
# Ubuntu/Debian
sudo apt install htop
# Arch Linux
sudo pacman -S htop
# Verify installation
htop --version
Basic Usage
# Launch htop
htop
# Sort by CPU usage
htop -s PERCENT_CPU
# Sort by memory usage
htop -s PERCENT_MEM
# Show only specific user processes
htop -u username
# Key bindings:
# F1 - help
# F2 - setup
# F3 - search
# F4 - filter
# F5 - tree view
# F6 - sort
# F9 - kill process
# F10 - quit
btop - Modern system monitor
Installation
# macOS
brew install btop
# Ubuntu/Debian
sudo apt install btop
# Arch Linux
sudo pacman -S btop
# Cargo (Rust)
cargo install btop
# Verify installation
btop --version
Network Tools
httpie - Better curl
Installation
# macOS
brew install httpie
# Ubuntu/Debian
sudo apt install httpie
# Arch Linux
sudo pacman -S httpie
# Python pip
pip install httpie
# Verify installation
http --version
Basic Usage
# GET request
http GET https://api.github.com/user
# POST request with JSON
http POST https://api.example.com/users name=John email=john@example.com
# POST request with file
http POST https://api.example.com/upload file@image.jpg
# Add headers
http GET https://api.github.com/user Authorization:"Bearer token"
# Save response to file
http GET https://api.github.com/user > response.json
# Follow redirects
http --follow GET https://example.com
# Show only headers
http --headers GET https://api.github.com/user
Configuration and Setup
Shell Integration
Zsh Configuration
# Add to ~/.zshrc
# fzf integration
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# zoxide integration
eval "$(zoxide init zsh)"
# Custom aliases
alias ls="exa"
alias cat="bat"
alias find="fd"
alias grep="rg"
alias top="htop"
# fzf key bindings
bindkey '^T' fzf-file-widget
bindkey '^R' fzf-history-widget
bindkey '^G' fzf-cd-widget
Bash Configuration
Bash Setup
# Add to ~/.bashrc
# fzf integration
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
# zoxide integration
eval "$(zoxide init bash)"
# Custom aliases
alias ls="exa"
alias cat="bat"
alias find="fd"
alias grep="rg"
alias top="htop"
# fzf key bindings
bind '"\C-t": fzf-file-widget'
bind '"\C-r": fzf-history-widget'
bind '"\C-g": fzf-cd-widget'
Advanced Usage
Tool Combinations
Powerful Combinations
# Find and edit files
fd "config" | fzf | xargs code
# Search and view files
rg "TODO" -l | fzf --preview 'bat {}'
# Find and delete files
fd "*.tmp" | fzf -m | xargs rm
# Search in git history
git log --oneline | fzf | cut -d' ' -f1 | xargs git show
# Find large files
fd -t f | xargs ls -lh | sort -k5 -hr | head -10
# Search and replace
rg "old-text" -l | xargs sed -i 's/old-text/new-text/g'
Custom Functions
Useful Functions
# Find and edit
fe() {
local file
file=$(fd -t f | fzf --preview 'bat {}')
[ -n "$file" ] && ${EDITOR:-code} "$file"
}
# Find and cd
fcd() {
local dir
dir=$(fd -t d | fzf)
[ -n "$dir" ] && cd "$dir"
}
# Search and view
sg() {
local file
file=$(rg "$1" -l | fzf --preview "bat {}")
[ -n "$file" ] && bat "$file"
}
# Git log with fzf
glog() {
git log --oneline | fzf | cut -d' ' -f1 | xargs git show
}
Performance Tips
Optimization Strategies
Speed Improvements
- Use fd instead of find
- Use rg instead of grep
- Use exa instead of ls
- Use bat instead of cat
- Use zoxide for navigation
Memory Usage
- Limit search scope
- Use appropriate flags
- Exclude large directories
- Use streaming when possible
- Monitor resource usage
Summary
These command line productivity tools will significantly improve your development workflow:
- File Operations: exa, bat, fd for better file handling
- Search: ripgrep for fast text search, fzf for fuzzy finding
- Navigation: zoxide for smart directory jumping
- Development: git-delta, lazygit for better Git experience
- System: htop, btop for system monitoring
- Network: httpie for API testing
Need More Help?
Struggling with command line productivity or need help setting up these tools? Our CLI experts can help you optimize your terminal workflow.
Get CLI Help