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.
unalias alias_name_1 alias_name_2 ...
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
.
> alias hello="echo hello-educative"
> hello
> alias curr_date="date"
> curr_date
> unalias hello curr_date
> hello
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.