Script Valley
Developer Environment Setup (WSL, Terminal, VS Code)
Shell Configuration and ProductivityLesson 3.2

How to create shell aliases to speed up your workflow

alias syntax, unalias, common developer aliases, alias persistence in .bashrc, alias vs function, quoting in aliases

Shell Aliases

Shell alias mapping diagram

Aliases are shortcuts: you define a short name for a longer command. They save keystrokes and reduce typos for commands you run dozens of times a day.

Alias syntax

alias gs='git status'
alias gp='git push'
alias gc='git commit -m'

No spaces around =. Use single quotes to prevent the shell from expanding variables at definition time.

Practical developer aliases

alias ll='ls -lah'
alias ..='cd ..'
alias ...='cd ../..'
alias cls='clear'
alias serve='python3 -m http.server 8000'

Making aliases permanent

echo "alias ll='ls -lah'" >> ~/.bashrc
source ~/.bashrc

Removing an alias in the current session

unalias gs

When to use a function instead

Aliases cannot accept arguments. If you need logic or parameters, use a function:

mkcd() {
  mkdir -p "$1" && cd "$1"
}
# Usage: mkcd new-project

Add functions to .bashrc the same way as aliases.

Up next

How to install and use Zsh with Oh My Zsh on WSL2

Sign in to track progress

How to create shell aliases to speed up your workflow โ€” Shell Configuration and Productivity โ€” Developer Environment Setup (WSL, Terminal, VS Code) โ€” Script Valley โ€” Script Valley