Terminal

Terminal Aliases: The 10-Minute Setup That Saves Hours Every Week

The commands you type fifty times a day deserve better than fifty keystrokes. Here's how to set up aliases that actually stick.

May 12, 2026
4 min read

Technologies Discussed

TerminalProductivityCLIShell

Why Aliases Matter at Scale

As a developer, the terminal is your second home. Aliases aren't just a convenience — they reduce context-switching, keep your hands on the keyboard, and eliminate the cognitive load of remembering long flag combinations.

Setting Up Permanent Aliases

Add aliases to your shell config file so they persist across sessions.

**For bash** — add to `~/.bashrc` **For zsh** — add to `~/.zshrc`

bash
# Open your config file
code ~/.zshrc   # or vim ~/.zshrc

Add your aliases, save, then reload:

bash
source ~/.zshrc

The Developer Starter Pack

bash
# ── Navigation ──────────────────────────────────────────
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'

# ── File listing ───────────────────────────────────────── alias ll='ls -lah' # long list with hidden files, human-readable sizes alias lt='ls -lath' # same but sorted by modification time (newest first)

# ── Git shortcuts ───────────────────────────────────────── alias gs='git status' alias ga='git add .' alias gc='git commit -m' # usage: gc "your message" alias gp='git push' alias gl='git log --oneline --graph --decorate -20' alias gco='git checkout' alias gb='git branch'

# ── Node / npm ──────────────────────────────────────────── alias ni='npm install' alias nid='npm install --save-dev' alias nr='npm run' alias nrd='npm run dev' alias nrb='npm run build'

# ── Quick edits ─────────────────────────────────────────── alias zshconfig='code ~/.zshrc' alias reload='source ~/.zshrc'

# ── Utilities ───────────────────────────────────────────── alias ip='curl -s ifconfig.me' # your public IP alias ports='lsof -i -P | grep LISTEN' # show open ports alias diskusage='du -sh * | sort -h' # disk usage sorted by size

Going Further: Shell Functions

When an alias needs arguments, use a function:

bash
# Create directory and immediately cd into it
mkcd() {
  mkdir -p "$1" && cd "$1"
}

# Fuzzy-find and open a file in VS Code fcode() { code $(find . -name "*$1*" | head -1) }

# Kill whatever is running on a given port killport() { lsof -ti tcp:"$1" | xargs kill -9 }

# Usage: # mkcd my-new-project # killport 3000

Organizing for the Long Term

Once your alias file grows, split it out:

bash
# In ~/.zshrc
source ~/.aliases       # load aliases from a separate file
source ~/.functions     # load functions from a separate file

This makes your aliases easy to version-control and share across machines.

Takeaway

Spend 10 minutes setting up aliases now. You'll recoup that investment within the first hour of use — and every day after.

About the Author

Rajeev Ranjan Sinha is a full-stack engineer with 10+ years of experience building scalable web applications. He specializes in JavaScript/TypeScript, cloud architecture, and system design.

Get more articles like this

Subscribe to my newsletter for in-depth articles, quick tips, and insights on web development.