Return alias names for Cmdlets. An alias is an alternate (usually shorter) name for a cmdlet, script, function, or executable file. By default, Get-Alias takes an alias and returns the command name, with the -Definition parameter set, Get-Alias will accept a command name and return its alias.

      Get-Alias [ [-Name] string[] ]
         [-scope string] [-exclude string[] ] [CommonParameters]

      Get-Alias [-Definition string[]]
         [-scope string] [-exclude string[] ] [CommonParameters]

   -Name string[]
       The alias to retrieve. By default, all aliases defined for the current session.
       (the "-Name" is optional)

   -Definition string[]
Get the aliases for the specified item. Enter the name of a cmdlet, function, script, file, or executable.

The alias object contains a property called 'Definition' which holds this information for each Alias. -scope string The scope in which this alias is valid. Valid values are "Global", "Local", or "Script", or a number relative to the current scope ( 0 through the number of scopes, where 0 is the current scope and 1 is its parent). "Local" is the default. For more, type "get-help about_scope". -exclude string[] Omit the specified items, wildcards allowed e.g. "*ms*"

Standard Aliases for Get-Alias: gal

The 'built-in' aliases supplied with PowerShell have the option AllScope set, so they will survive any changes in scope.
The 'built-in' aliases that are idiomatic to PowerShell also have the ReadOnly option set.

Aliases are primarily designed to promote high-speed interactive use of PowerShell, when writing scripts that will be shared with other users it is often better to use the full cmdlet names as this will improve the scripts readability.

PowerShell uses a standard set of aliases for common nouns and verbs. Example abbreviations:

Noun or Verb Abbreviation
Get g
Set s
Item i
Location l
Command cm
Alias al

These can be combined to figure out the standard alias for many cmdlets e.g. Set-Item will be si and Get-Alias will be gal

You can also view aliases via the Alias provider that exposes a drive called Alias: much like a file system drive:

Set-Location alias:

Parameter aliases

In addition to cmdlet/function aliases, there are also aliases for many parameters, list them for a cmdlet with:

Get-Command Get-Childitem | % Parameters | % Values | Select Name, Aliases

For parameters, PowerShell will also accept the shortest string that will uniquely identify the parameter.


Retrieve all aliases for the current session, displaying the cmdlet and the alias name:

PS C:\> get-alias

Retrieve all aliases that start with the letter S:

PS C:\> get-alias -name s*

Retrieve all aliases that reference the Set-Location cmdlet:

PS C:\> get-alias | where-object {$_.Definition -eq 'Set-Location'}

Retrieve all the aliases that have the ReadOnly option set:

PS C:\> get-alias | where-object {($_.Options -split ',') -contains 'ReadOnly'}

Retrieve all aliases and display their definition and options:

PS C:\> get-alias | format-table name,definition,options -auto

#There are places I remember
All my life, though some have changed# ~ The Beatles (In My Life)

Related PowerShell Cmdlets

Get-Command - Get basic information about PowerShell commands: cmdlets, files and functions.
export-alias - Export an alias list to a file.
import-alias - Import an alias list from a file.
new-alias - Create a new Cmdlet-alias pairing.
set-alias - Map an alias to a Cmdlet.

Copyright © 1999-2024
Some rights reserved