Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

alias - define or display aliases

&pagelevel(4)&pagelevel

You can use the built-in alias command in the POSIX shell sh to redefine shell commands. However, you may not use it to redefine reserved words. You can use the alias command to define and export alias variables as well as to write them to standard output. The unalias command is used to delete alias variables. Exported alias variables remain effective for procedures which are called by name. However, they must be reinitialized for any new, explicit calls to the POSIX shell. For the use of alias variables see the section “Aliasing”.

Syntax


Format 1:alias[ -t][ name]
Format 2:alias[ -x][ name[=value]]...



Format 1:alias[ -t][ name]


No option specified

alias with no arguments writes the list of aliases in the form name=value to standard output.

-t

is used to set and list alias variables which possess a path specification (tracked alias). The value of this type of variable consists of the full path name as far as name. While changing the value of PATH invalidates the value definition, name retains the path specification. If option -t is not set then the pair name=value is output for every name which has no associated value in the argument list.

-t not specified:
alias outputs the pair name=value for every name which has no associated value in the argument list.


Format 2:alias[ -x][ name[=value]]...


A space at the end of value causes the next word in the command line to be checked for alias substitution.

-x

is used to set and output exported alias variables. An exported alias variable is defined for procedures which are called by name.

Exit status

The exit status is non-zero if no value is defined for name.

Variable

PATH

Default variable for the POSIX shell. The absolute path name of the directories in which the POSIX shell is intended to search for commands is assigned to the variable.

Locale

The following environment variables affect the execution of alias:

LANG

Provide a default value for the internationalization variables that are unset or null. If LANG is unset of null, the corresponding value from the implementation-specific default locale will be used.

If any of the internationalization variables contains an invalid setting, the utility will behave as if none of the variables had been defined.

LC_ALL

If set to a non-empty string value, override the values of all the other internationalization variables.

LC_CTYPE

Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).

LC_MESSAGES

Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.

NLSPATH

Determine the location of message catalogs for the processing of LC_MESSAGES.

Example

You can use the following aliases to simplify the ls command:

$ alias ll='ls -l'

$ alias la='ls -al'

See also

unalias