TL;DR
-
Tools: Upgrade your default commands with modern replacements like fzf, bat, and zoxide.
-
Concepts: Master job control, brace expansion, and recursive globbing.
-
Scripts: Automate daily tasks with custom extraction and backup functions.
-
Configs: Supercharge your
.zshrcwith massive history retention and quality-of-life aliases.
Essential Terminal Tools
-
Homebrew: Use this package manager to install all the tools below on macOS.
-
fzf: A command-line fuzzy finder for instantly searching files, directories, and command history.
-
bat: A drop-in replacement for the
catcommand featuring syntax highlighting and Git integration. -
ripgrep (
rg): An incredibly fast search tool that respects your.gitignorefiles. -
zoxide (
z): A smartercdcommand that learns your habits and remembers your most visited directories. -
eza: A modern replacement for
lswith colors, file icons, and git status.
Powerful Terminal Concepts
-
Job Control: Suspend a running foreground task with
Ctrl+Z, resume it in the background withbg, and bring it back to the foreground withfg. -
Command Substitution: Use
$(command)to pass the output of one command as an argument to another (e.g.,kill -9 $(pgrep python)). -
Recursive Globbing: Use
**to search deeply through directories without thefindcommand (e.g.,ls **/*.jpglists all JPEGs in all nested subfolders). -
Brace Expansion: Generate arbitrary strings or folder structures quickly (e.g.,
mkdir -p project/{src,test,build,logs}creates four folders at once).
Super Helpful Scripts (Add to .zshrc)
Smart Archive Extractor
- Detects the file extension and automatically uses the correct decompression tool.
Bash
extract() {
if [ -f "$1" ] ; then
case "$1" in
*.tar.bz2) tar xjf "$1" ;;
*.tar.gz) tar xzf "$1" ;;
*.bz2) bunzip2 "$1" ;;
*.rar) unrar e "$1" ;;
*.gz) gunzip "$1" ;;
*.tar) tar xf "$1" ;;
*.tbz2) tar xjf "$1" ;;
*.tgz) tar xzf "$1" ;;
*.zip) unzip "$1" ;;
*.Z) uncompress "$1" ;;
*.7z) 7z x "$1" ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}Quick File Backup
- Instantly creates a
.bakcopy of a file without typing the name twice.
Bash
mkbkp() {
cp "$1" "$1.bak"
echo "Created backup: $1.bak"
}Quick Server
- Starts a local HTTP server in your current directory on port 8000 for quick file sharing or testing.
Bash
serve() {
python3 -m http.server 8000
}Awesome Zsh Configs (.zshrc)
Massive & Shared History
- Never lose a command again and sync history across all open terminal tabs immediately.
HISTFILE=~/.zsh_history
HISTSIZE=100000
SAVEHIST=100000
setopt INC_APPEND_HISTORY
setopt SHARE_HISTORY
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_REDUCE_BLANKSDirectory Navigation
- Type a folder name directly to enter it without using the
cdcommand.
setopt AUTO_CDQuality of Life Aliases
- Shortcuts for faster navigation and modern tool integration.
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias ls="eza --icons" # Requires eza installed
alias cat="bat" # Requires bat installed
alias reload="source ~/.zshrc && echo 'Zsh config reloaded!'"
alias path="echo -e \${PATH//:/\\\\n}" # Prints PATH cleanly on separate lines