display or create command aliases 

KornShell Built-in


alias [-ptx] [name[=value] ...]

alias -r


When the first word of a KornShell command line is not a shell keyword, the shell checks for the word in the list of currently defined aliases. If it finds a match, the shell replaces the alias with its associated string value. The result is a new command line that might begin with a shell function name, a built-in command, an external command or another alias.

When the shell performs alias substitution, it checks to see if value ends with a blank. If so, the shell also checks the next word of the command line for aliases. The shell then checks the new command line for aliases and expands them, following these same rules. This process continues until there are no aliases left on the command line or recursion occurs in the expansion of aliases.

Calling alias without parameters displays all the currently defined aliases and their associated values. Values appear with appropriate quoting so that they are suitable for re-input to the shell.

Calling alias with parameters in the form of


creates an alias for each name with the given string value.

If you are defining an alias where value contains a backslash character, you must precede it with another backslash since when the shell performs the expansion, it interprets a backslash as the escape character. If you use double quotes to enclose value, you must precede each component of a double backslash with an additional backslash since the shell escapes characters both when assigning the alias and again when expanding it.

To avoid using four backslashes to represent a single backslash, use apostrophes rather than double quotes to enclose value, since the shell does not escape characters enclosed in apostrophes during assignment. As a result, the shell only escapes characters within apostrophes when expanding the alias.

This is especially important on Windows systems if you use backslashes to separate path name components. For example, to create an alias for the cmd.exe print command that resides in c:\Windows\system32\print.exe, use one of the following two commands:

alias p="c:\\\\Windows\\\\system32\\\\print.exe"
alias p='c:\\Windows\\system32\\print.exe'

Calling alias with name without any value assignment, displays name and its associated value with appropriate quoting.



causes the output generated by alias to be in a form that is suitable for use as input to the shell for setting aliases.


removes all tracked aliases.


makes each name on the command line a tracked alias. Each tracked alias resolves to its full path name; thus the shell avoids searching the PATH directories whenever you invoke the command. The shell assigns the full path name of a tracked alias the first time that you invoke it. It reassigns a path name the first time you use the alias after changing the variable PATH. When you issue the command

set -h

each subsequent command you use in the shell automatically becomes a tracked alias. Invoking alias with the -t option, but without any specified names, displays all currently defined tracked aliases with appropriate quoting.


marks each alias name on the command line for export. If you specify -x without any names, alias displays all exported aliases. Only exported aliases are passed to a shell that runs a shell script (that is, script.ksh).

Built-in Aliases

There are several aliases built into the shell:

alias functions="typeset -f"
alias hash="alias -t"
alias history="fc -l"
alias integer="typeset -i"
alias nohup="nohup " 	
alias r="fc -s"	

On systems supporting job control:

alias stop="kill -STOP"
alias suspend="stop \$\$"

You can change or remove any of these aliases. See the relevant manual pages for details.


The command:

alias ls="ls -C"

defines ls as an alias. From this point onward, when you issue an ls command, it produces multi-column output by default. The alias command provides a simple way to access other functions built into cmd.exe. For example:

alias ver="cmd.exe /c ver"
alias rename="cmd.exe /c rename"
alias copy="cmd.exe /c copy"



When this variable is set, the Enhanced UNIX Compatibility Mode is on and the virtual file system is in use.

All aliases are stored as typed. When the Enhanced UNIX Compatibility Mode is on, path names in aliases are interpreted as being path names in the virtual file system; otherwise, path names in aliases are interpreted as being path names in the regular file system.

For example, suppose you define:

alias echotext="/usr/bin/echo.exe text"

Typing echotext on the command line attempts to run the echo.exe command found in the /usr/bin directory. When the Enhanced UNIX Compatibility Mode is on, it looks for echo.exe in the /usr/bin directory of the virtual file system (that is, the $ROOTDIR/mksnt directory of the regualr file system). When that mode is off, it looks for echo.exe in the /usr/bin directory of the regular file system (which would be x:/usr/bin where x is the drive letter of the current drive). This directory is unlikely to exist and the alias would fail.

For details on the Enhanced UNIX Compatibility Mode and the virtual file system, see the EUCM reference page.


Possible exit status values are:


Successful completion.


Failure because an alias could not be set.


Failure because of an invalid command line option.

If you define alias to determine the values of a set of names, the exit status is the number of those names that are not currently defined as aliases.


KornShell. POSIX.2. x/OPEN Portability Guide 4.0. Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.

On UNIX systems, alias is a built-in command of the KornShell, but not of the Bourne Shell.

The -t and -x options are extensions to the POSIX standard.


This command is built into the MKS KornShell.

Since exported aliases are only available in the current shell environment and to the child processes of this environment, they are unavailable to any new shell environments that are started. To make an alias available to all shell environments, define it as a non-exported alias in the MKS KornShell ENV file, which is executed whenever a new shell is run.


PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC Windchill Requirements and Validation


fc, functions, hash, history, integer, r, set, sh, typeset, unalias

Using the MKS KornShell

PTC MKS Toolkit 10.4 Documentation Build 39.