How to find cmdlet aliases in PowerShell
Aliases in PowerShell are alternate names given to commands. You can think of them as nicknames for commands. For example, pwd
is an alias of Get-Location
, and rm
is an alias for Remove-Item
. Aliases are useful for shortening the name of a command, or to provide a different name that may be more familiar to the user.
Get the aliases for all PowerShell cmdlets
The Get-Alias
cmdlet is used to display all the aliases that are available in
the current PowerShell session:
Get-Alias
CommandType Name Version Source
----------- ---- ------- ------
Alias ? -> Where-Object
Alias % -> ForEach-Object
Alias ac -> Add-Content
Alias cat -> Get-Content
Alias cd -> Set-Location
Alias chdir -> Set-Location
Alias clc -> Clear-Content
Alias clear -> Clear-Host
Alias clhy -> Clear-History
Alias cli -> Clear-Item
Alias clp -> Clear-ItemProperty
Alias cls -> Clear-Host
Alias clv -> Clear-Variable
Alias cnsn -> Connect-PSSession
Alias compare -> Compare-Object
Alias copy -> Copy-Item
Alias cp -> Copy-Item
Alias cpi -> Copy-Item
. . .
Check the alias for a specific PowerShell cmdlet
To check the alias for a specific cmdlet, pass the cmdlet name to the
-Definition
parameter as shown below:
Get-Alias -Definition New-Item
CommandType Name Version Source
----------- ---- ------- ------
Alias ni -> New-Item
As you can see from the above output, ni
is the alias for New-Item
in this
case.
Thanks for reading, and happy scripting!