Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026
The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.
Using aliases we can set up shortcuts for common commands.
Defining Aliases
Use this syntax:
alias <newcommand>='<command>'
Example:
alias ll='ls -al'
Now typing ll runs ls -al.
This works in Bash, Zsh, and Fish shell.
Persisting Aliases
If you define an alias in the shell, it only lasts for the current session. To make it permanent, add it to your shell configuration file:
- Bash:
~/.bashrcor~/.bash_profile - Zsh:
~/.zshrc - Fish:
~/.config/fish/config.fish
Open the file:
code ~/.bashrc
Add your aliases:
alias ll='ls -al'
alias gs='git status'
alias gc='git commit'
Apply changes without restarting:
source ~/.bashrc
Useful Alias Examples
Git shortcuts:
alias gs='git status'
alias gc='git commit'
alias gp='git push'
alias gl='git log --oneline'
Navigation:
alias ..='cd ..'
alias ...='cd ../..'
alias home='cd ~'
Safety nets:
alias rm='rm -i' # confirm before deleting
alias cp='cp -i' # confirm before overwriting
alias mv='mv -i' # confirm before overwriting
Quotes Matter
Be careful with quotes when using variables:
alias lsthis="ls $PWD" # $PWD resolved when alias is defined
alias lscurrent='ls $PWD' # $PWD resolved when alias is used
With double quotes, the variable is resolved at definition time. With single quotes, it’s resolved at invocation time.
If you navigate to a new folder:
lsthisstill lists files from where you defined the aliaslscurrentlists files from your current folder
Removing Aliases
Use unalias to remove an alias:
unalias ll
Viewing Aliases
List all defined aliases:
alias
Or check a specific alias:
alias ll