Linux Commands | Misc | alias Command Substitution
alias Command
The alias command replaces complex commands and options with strings that can be entered more simply.
Usage
alias [shortcut]='[command]'
alias Command Examples
Example 1
Check commands registered as aliases.
alias
Example 2
Make c perform the same function as the clear command.
alias c='clear'
Example 3
Make m perform the same function as the mkdir -p a/b/c command.
alias m='mkdir -p a/b/c'
Permanently Save alias Commands
Configured aliases disappear when the terminal window is closed.
To save them permanently, store them in .bashrc.
The .bashrc file is located at ~account-name/.bashrc.
An alias command saved by account A cannot be used by account B.
How to Save
- Enter
cat >> ~root/.bashrc. - Enter the alias you want to save.
- Press Enter, then press
Ctrl+C. - Close and reopen the terminal window, or enter the command below.
- chsh -s /bin/bash