HxHippy

unalias

Remove an alias

Overview

Removes aliases that were previously defined with the `alias` command or in shell configuration files. This allows users to undo or remove shortcuts they no longer need.

Syntax

unalias [-a] NAME [NAME ...]

Common Options

NAME

The name of the alias to remove.

-a

Remove all currently defined aliases from the current shell session.

Persistence

To permanently remove an alias, you must also remove its definition from the relevant shell startup file (e.g., `~/.bashrc`, `~/.zshrc`) and then source the file or open a new terminal.

Examples

$ unalias ll

Removes the alias named `ll`.

$ unalias myip update_system

Removes both the `myip` and `update_system` aliases.

$ unalias -a

Removes all aliases for the current shell session.

$ # To permanently remove an alias (e.g., `backup` defined in ~/.bashrc):

$ # 1. Remove from current session:

unalias backup

$ # 2. Edit ~/.bashrc and delete the line:

# alias backup='rsync -avh --delete source/ dest/'

$ # 3. Reload shell configuration:

source ~/.bashrc

unaliasaliasremovedeleteshortcutshellbashzsh