Using familiar command names
PowerShell supports aliases to refer to commands by alternate names. Aliasing allows users with experience in other shells to use common command names that they already know for similar operations in PowerShell.
Aliasing associates a new name with another command. For example, PowerShell has an internal
Clear-Host that clears the output window. You can type either the
clear alias at a command prompt. PowerShell interprets these aliases and runs the
This feature helps users to learn PowerShell. First, most cmd.exe and Unix users have a large
repertoire of commands that users already know by name. The PowerShell equivalents may not produce
identical results. However, the results are close enough that users can do work without knowing the
PowerShell command name. "Finger memory" is another major source of frustration when learning a
new command shell. If you have used cmd.exe for years, you might reflexively type the
to clear the screen. Without the alias for
Clear-Host, you receive an error message and won't
know what to do to clear the output.
The following list shows a few of the common cmd.exe and Unix commands that you can use in PowerShell:
Get-Alias cmdlet shows you the real name of the native PowerShell command associated with an
PS> Get-Alias cls
CommandType Name Version Source ----------- ---- ------- ------ Alias cls -> Clear-Host
Interpreting standard aliases
The aliases we described previous were designed for name-compatibility with other command shells. Most aliases built into PowerShell are designed for brevity. Shorter names are easier to type, but are difficult to read if you don't know what they refer to.
PowerShell aliases try to compromise between clarity and brevity. PowerShell uses a standard set of aliases for common nouns and verbs.
|Noun or Verb||Abbreviation|
These aliases are understandable when you know the shorthand names.
Once you're familiar with PowerShell aliasing, it's easy to guess that the sal alias refers
Creating new aliases
You can create your own aliases using the
Set-Alias cmdlet. For example, the following statements
create the standard cmdlet aliases previously discussed:
Set-Alias -Name gi -Value Get-Item Set-Alias -Name si -Value Set-Item Set-Alias -Name gl -Value Get-Location Set-Alias -Name sl -Value Set-Location Set-Alias -Name gcm -Value Get-Command
Internally, PowerShell uses similar commands during startup, but these aliases are not changeable. If you try to execute one of these commands, you get an error explaining that the alias can't be modified. For example:
PS> Set-Alias -Name gi -Value Get-Item Set-Alias : Alias is not writeable because alias gi is read-only or constant and cannot be written to. At line:1 char:10 + Set-Alias <<<< -Name gi -Value Get-Item