Report issue Add example

unalias

Remove aliases set by the alias command

Synopsis

unalias [-a] name [name ...]

Main Purpose

Options

-a: Remove all defined aliases.

Parameters

name: Specifies one or more defined aliases to be removed.

Return Value

unalias returns true unless the alias you are trying to remove is not defined.

Examples

# Remove all defined aliases
unalias -a

# Remove specific defined aliases (assuming they exist in the current environment)
unalias vi
unalias ls grep

Incorrect Usage

Notes

  1. When executing scripts:

If a bash script executed via the source command runs alias or unalias, it may affect the alias settings of the terminal environment. Alias settings in the terminal can also affect the results of the script. Scripts called via sh or executed directly with proper permissions are not affected by the terminal environment's alias settings.

  1. To view or set aliases, see the alias command.
  2. This command is a bash built-in; see the help command for related help information.