*** Welcome to piglix ***

Alias (Unix shell)


In computing, alias is a command in various command line interpreters (shells) such as Unix shells, 4DOS/4NT and Windows PowerShell, which enables a replacement of a word by another string. It is mainly used for abbreviating a system command, or for adding default arguments to a regularly used command. Aliasing functionality in the MS-DOS and Microsoft Windows operating systems is provided by the DOSKey command-line utility.

An alias will last for the life of the shell session. Regularly used aliases can be set from the shell's configuration file (~/.cshrc or the systemwide /etc/csh.cshrc for csh, or ~/.bashrc or the systemwide /etc/bashrc or /etc/bash.bashrc for bash) so that they will be available upon the start of the corresponding shell session. The alias commands may either be written in the config file directly or sourced from a separate file, typically named .alias (or .alias-bash, .alias-csh, etc., if multiple shells may be used).

Non-persistent aliases can be created by supplying name/value pairs as arguments for the alias command. In Unix shells the syntax is:

The corresponding syntax in the C shell or tcsh shell is:

This alias means that when the command copy is read in the shell, it will be replaced with cp and that command will be executed instead.

In the 4DOS/4NT shell the following syntax is used to define cp as an alias for the 4DOS copy command:

To create a new alias in Windows PowerShell, the new-alias cmdlet can be used:

This creates a new alias called ci that will be replaced with the copy-item cmdlet when executed.

In PowerShell, an alias cannot be used to specify default arguments for a command. Instead, this must be done by adding items to the collection $PSDefaultParameterValues, one of the PowerShell preference variables.


...
Wikipedia

...