TrumanWong

unalias

Remove aliases set by alias

Summary

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

The main purpose

  • Delete one or more aliases.
  • Delete all defined aliases.

Options

-a: Delete all defined aliases.

Parameters

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

return value

unalias returns true unless the alias you want to remove is undefined.

example

# Delete all defined aliases
unalias -a

# Delete defined aliases (assuming the following aliases exist in the current environment)
unaliasvi
unalias ls grep

Incorrect usage

  • The alias to be deleted is undefined.

  • The name parameter is not passed when the -a option is not used.

Notice

  1. Please note when executing the script:

If a bash script executed using the source command executes the alias or unalias command, it may have an impact on the alias settings of the terminal environment; the alias settings of the terminal environment may also change the running results;

Bash scripts called through sh or scripts directly run by the current user with execution permissions are not affected by the alias of the terminal environment.

  1. To view and set aliases, please view the alias command.

  2. This command is a built-in bash command. For related help information, please see the help command.