Aliases in the Linux Terminal: What They Are and How to Create Your Own
How to make them permanent by editing your .bashrc file.
An alias is a shortcut you set for a long command or one you type often, so you don't have to type it out in full every time.
Creating one (temporary, this session only)
alias update="sudo apt update && sudo apt upgrade -y"
From now on, typing update runs that entire command.
Making it permanent
Add the same line to the end of your ~/.bashrc file (or
~/.zshrc if you use Zsh):
nano ~/.bashrc
# add your alias line at the end, save and close
source ~/.bashrc
source applies the changes without needing to close
and open a new terminal.
Tip: some useful, common aliases:
alias ll="ls -la" (detailed listing),
alias ..="cd .." (go up one folder),
alias grep="grep --color=auto" (highlight matches).
Note: an alias only replaces what you type in the terminal — it doesn't affect scripts or how other programs invoke those same commands internally.
Frequently asked questions
Why does my alias disappear when I close the terminal?
Because you created it just for that session. To make it permanent, add the same line to your ~/.bashrc file (or ~/.zshrc) and run 'source' on it.
Do aliases affect the scripts I run?
No, they only apply to what you type directly in your own interactive terminal, not to commands inside scripts.