What is the unalias command in Linux?

Overview

The aliases created during the current login session are removed using the unalias command.

Permanent aliases can be suppressed using the unalias command; however, they are only impacted for the current login session and are restored once the user signs in again.

To create aliases, refer to this answer.

Syntax


unalias alias_name_1 alias_name_2 ...

Arguments

unalias can take any number of aliases.

We use the -a option to remove all the aliases in the current user session, i.e., unalias -a.

Code

> alias hello="echo hello-educative"
> hello
> alias curr_date="date"
> curr_date
> unalias hello curr_date
> hello  
Terminal 1
Terminal
Loading...

Explanation

In the image above, we create two aliases and remove the aliases using the unalias command.

Once the aliases are removed, they won’t be available for further use.

Free Resources