~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; command3

Example:


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_name

Example:


type test

Output:


test is a shell builtin

Choose a different name, such as foo:


type foo

Output:


bash: type: foo: not found

Creating an Alias


Syntax:


alias name='command'

  • name: Alias name
  • command: Commands to execute

Example


alias foo='cd /usr; ls; cd -'

Now, running:


foo

Will execute all three commands.


Checking Defined Aliases


type foo

Output:


foo is aliased to `cd /usr; ls; cd -'

To see all defined aliases:


alias

Common 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 foo
type foo

Output:


bash: type: foo: not found

Making 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