Defines or displays aliases.
alias [ -t ] [ -x ] [ AliasName [ =String ] ] ...
The alias command creates or redefines alias definitions or writes existing alias definitions to standard output.
If no flags or parameters are supplied, all existing alias definitions are written to standard output. You can display a specific alias definition by using the AliasName parameter.
Create a new alias by using the AliasName=String parameter pair. When the shell encounters an alias on the command line or in a shell script, it substitutes the definition supplied by the string. The String variable can contain any valid shell text. Enclose the value of the String variable in single quotes if the string contains spaces. If the AliasName parameter is not a valid name, the alias command displays an error message.
If you specify the -t flag, the shell displays aliases that are tracked. A tracked command uses the full path name of the command. A tracked command can become undefined when the value of the PATH environment variable is reset, but aliases created with the -t flag remain tracked.
If you specify the -x flag, the shell displays aliases that are exported. An exported alias is active in all shells.
An alias definition affects the current shell environment and the execution environments of any subshells. The alias definition affects neither the parent process of the current shell nor any utility environment invoked by the shell.
The following exit values are returned:
0 | Successful completion. |
>0 | One of the specified alias name did not have an alias definition, or an error occurred. |
alias ls='ls -CF'
alias r='fc -s'
alias du=du\ -k
alias psc='ps -ef | grep Dee'
alias -t ls
The screen displays ls=/usr/bin/ls.
/usr/bin/ksh | Contains the Korn shell alias built-in command. |
/usr/bin/alias | Contains the alias command. |
The ksh command.