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 directory

Or use z for frecent navigation:

# After visiting ~/projects/myapp multiple times
z myapp  # Jumps there instantly

Useful CLI Tools

fzf - Fuzzy finder

# Search files
vim $(fzf)
 
# Search history
Ctrl+R  # (fzf enhances this)
 
# Search git branches
git checkout $(git branch | fzf)
rg "pattern" .          # Search current directory
rg -i "pattern"         # Case insensitive
rg -t py "pattern"      # Only Python files
rg -l "pattern"         # List matching files only

jq - 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 output

bat - Better cat

bat file.py  # Syntax highlighting, line numbers

htop - Better top

htop  # Interactive process viewer

tmux 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    # Detach

Quick 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

  1. Learn one shortcut per week — compound over time
  2. Alias common commands — if you type it often, shorten it
  3. Use tab completion — faster than typing
  4. Master Ctrl+R — history search is powerful
  5. Try new tools — ripgrep, fzf, jq are worth learning

The terminal rewards investment. Small improvements add up.

React to this post: