The alias built-in defines and/or prints aliases.


  • alias [-gp] [name[=value]…]


The alias built-in defines and/or prints aliases as specified by operands. The printed aliases can be used as (part of) shell commands. The built-in prints all currently defined aliases when given no operands.



With this option, aliases are defined as global aliases; without this option, as normal aliases.


With this option, aliases are printed in a full command form like alias -g foo='bar'. Without this option, only command operands are printed like foo='bar'.



The name of an alias that should be printed.


The name and value of an alias that is being defined.

Exit status

The exit status of the alias built-in is zero unless there is any error.


The characters that cannot be used in an alias name are the space, tab, newline, and any of =$<>\'"`;&|()#. You can use any characters in an alias value.

The alias built-in is a mandatory built-in.

The POSIX standard defines no options for the alias built-in, thus no options are available in the POSIXly correct mode.