When the first word of a shell command line is not a shell keyword, alias causes the shell to check 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 reinput to the shell.
Calling alias with parameters of the form name=value creates an alias for each name with the string value.
If you are defining an alias where value contains a backslash character, you must precede it with another backslash. The shell interprets the backslash as the escape character when it performs the expansion. If you use double quotation marks to enclose value, you must precede each of the two back slashes with an additional backslash, because the shell escapes characters—that is, the shell does not interpret the character as it normally does—both when assigning the alias and again when expanding it.
To avoid using four back slashes to represent a single backslash, use single quotation marks rather than double quotation marks to enclose value, because the shell does not escape characters enclosed in single quotation marks during assignment. As a result, the shell escapes characters in single quotation marks only when expanding the alias.
Calling alias with name without any value assignment displays the function name (name) and its associated string value (value) with appropriate quoting.
DBCS recommendation: Use single-byte characters when specifying an alias name, because the POSIX standard states that alias names must contain only characters in the POSIX portable character set.
See also the information about unalias in the tcsh shell in unalias — Remove alias definitions.
set –h
each
subsequent command you use in the shell automatically becomes a tracked
alias. Running alias with the –t option,
but without any specified names, displays all currently defined tracked
aliases with appropriate quoting.alias autoload="typeset –fu"
alias functions="typeset –f"
alias hash="alias –t"
alias history="fc –l"
alias integer="typeset –i"
alias nohup="nohup "
alias r="fc –s"
alias stop="kill –STOP"
alias suspend="stop \$\$"
You can change or remove any of these aliases. These changes remain in effect for the current shell and any shell scripts or child shells invoked implicitly from the command. These aliases are reset to their default built-in values each time a new shell is invoked from the command line.
alias ls="ls –C"
defines ls as
an alias. From this point on, when you issue an ls command,
it produces multicolumn output by default.alias mf 'more \!-1$'
creates an
alias for looking at the file named by the final argument of the previously
entered command. Example output would be the following: alias mf 'more \!-1$'
echo "We love tcsh." > file1
mf
We love tcsh.
"file1" (EOF)
where mf pulls the last argument of the
previous command (file1), and then displays
that file using the more command.See Localization for more information.
If you define alias to determine the values of a set of names, the exit value is the number of those names that are not currently defined as aliases.
POSIX.2 User Portability Extension, UNIX KornShell.
The –t and –x options are extensions to the POSIXstandard.
fc, hash, nohup, set, sh, typeset, unalias, tcsh