I spend most of my day in the terminal. Here's how I make it fast.
Shell Aliases
Add to ~/.zshrc or ~/.bashrc:
# Git shortcuts
alias g="git"
alias gs="git status"
alias gd="git diff"
alias gc="git commit"
alias gp="git push"
alias gl="git log --oneline -10"
# Common commands
alias ll="ls -la"
alias ..="cd .."
alias ...="cd ../.."
# Python
alias py="python3"
alias pip="pip3"
alias venv="python -m venv .venv && source .venv/bin/activate"
alias activate="source .venv/bin/activate"
# Quick edits
alias zshrc="$EDITOR ~/.zshrc"
alias reload="source ~/.zshrc"Keyboard Shortcuts
Essential readline shortcuts:
Ctrl+A Move to start of line
Ctrl+E Move to end of line
Ctrl+W Delete word before cursor
Ctrl+U Delete line before cursor
Ctrl+K Delete line after cursor
Ctrl+R Search command history
Ctrl+L Clear screen
Ctrl+C Cancel current command
Ctrl+D Exit shell
Command History
# Search history
Ctrl+R # Then type to search
!! # Repeat last command
!$ # Last argument of previous command
!^ # First argument of previous command
!* # All arguments of previous command
# Examples
mkdir -p new/directory
cd !$ # cd new/directory
vim file.txt
mv !$ backup/ # mv file.txt backup/Directory Navigation
# Pushd/popd stack
pushd ~/projects/app
# Do work...
popd # Back to where you were
# Quick shortcuts
cd - # Previous directory
cd # Home directory
cd ~ # Home directoryOr use z for frecent navigation:
# After visiting ~/projects/myapp multiple times
z myapp # Jumps there instantlyUseful CLI Tools
fzf - Fuzzy finder
# Search files
vim $(fzf)
# Search history
Ctrl+R # (fzf enhances this)
# Search git branches
git checkout $(git branch | fzf)ripgrep - Fast search
rg "pattern" . # Search current directory
rg -i "pattern" # Case insensitive
rg -t py "pattern" # Only Python files
rg -l "pattern" # List matching files onlyjq - JSON processing
curl api.example.com | jq '.' # Pretty print
curl api.example.com | jq '.users[0]' # Extract field
cat data.json | jq -r '.name' # Raw outputbat - Better cat
bat file.py # Syntax highlighting, line numbershtop - Better top
htop # Interactive process viewertmux Basics
Terminal multiplexer:
tmux new -s work # New session named "work"
tmux attach -t work # Attach to session
tmux ls # List sessions
# Inside tmux
Ctrl+B c # New window
Ctrl+B n # Next window
Ctrl+B p # Previous window
Ctrl+B % # Split vertical
Ctrl+B " # Split horizontal
Ctrl+B d # DetachQuick Functions
# Make directory and cd into it
mkcd() {
mkdir -p "$1" && cd "$1"
}
# Extract any archive
extract() {
case $1 in
*.tar.gz) tar xzf "$1" ;;
*.tar.bz2) tar xjf "$1" ;;
*.zip) unzip "$1" ;;
*.gz) gunzip "$1" ;;
*) echo "Unknown format: $1" ;;
esac
}
# Quick HTTP server
serve() {
python -m http.server ${1:-8000}
}My .zshrc Essentials
# History
HISTSIZE=10000
SAVEHIST=10000
setopt SHARE_HISTORY
setopt HIST_IGNORE_DUPS
# Prompt
PS1='%~ $ '
# Path
export PATH="$HOME/.local/bin:$PATH"
# Editor
export EDITOR="vim"Tips
- Learn one shortcut per week — compound over time
- Alias common commands — if you type it often, shorten it
- Use tab completion — faster than typing
- Master Ctrl+R — history search is powerful
- Try new tools — ripgrep, fzf, jq are worth learning
The terminal rewards investment. Small improvements add up.
React to this post: