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

  1. Enter cat >> ~root/.bashrc.
  2. Enter the alias you want to save.
  3. Press Enter, then press Ctrl+C.
  4. Close and reopen the terminal window, or enter the command below.
  • chsh -s /bin/bash