~2 min read • Updated Jul 18, 2025
Linux offers flexible customization tools for command-line users. Among them, the alias command lets you create custom shortcuts for frequently used or multi-step commands. This enhances workflow speed and reduces repetitive typing. This article explains how to define, verify, remove, and persist aliases efficiently.
Running Multiple Commands on One Line
You can chain commands using semicolons:
command1; command2; command3Example:
cd /usr; ls; cd -This changes to /usr, lists its contents, then returns to the previous directory. Such sequences are ideal candidates for alias shortcuts.
Checking for Existing Command Names
Before assigning an alias, use type to check if the name already exists:
type command_nameExample:
type testOutput:
test is a shell builtinChoose a different name, such as foo:
type fooOutput:
bash: type: foo: not foundCreating an Alias
Syntax:
alias name='command'- name: Alias name
- command: Commands to execute
Example
alias foo='cd /usr; ls; cd -'Now, running:
fooWill execute all three commands.
Checking Defined Aliases
type fooOutput:
foo is aliased to `cd /usr; ls; cd -'To see all defined aliases:
aliasCommon Fedora Aliases
alias l.='ls -d .* --color=tty'
alias ll='ls -l --color=tty'
alias ls='ls --color=tty'
Removing an Alias
Use unalias to delete:
unalias footype foo
Output:
bash: type: foo: not foundMaking Aliases Persistent
Aliases created in the terminal last only for the current session. To make them permanent, add them to:
~/.bashrc- or
~/.bash_aliases(if your system supports it)
Conclusion
The alias command provides a simple way to enhance command-line efficiency by creating custom shortcuts. With clear naming, proper management, and persistence setup, aliases become a powerful tool for terminal productivity.
Written & researched by Dr. Shahin Siami