CmdID / PowerShell / Cmdlets / Get
Get-Alias
Gets the aliases for the current session. PowerShell reference
From the PowerShell reference
4 parameters
Alias gal
What it does
Gets the aliases for the current session. The Get-Alias cmdlet gets the aliases in the current session. This includes built-in aliases, aliases that you have set or imported, and aliases that you have added to your PowerShell profile. By default, Get-Alias takes an alias and returns the command name. When you use the Definition parameter, Get-Alias takes a command name and returns its aliases. Beginning in Windows PowerShell 3.0, Get-Alias displays non-hyphenated alias names in an <alias> -> <definition> format to make it even easier to find the information that you need.
Get-Alias [[-Name] <String[]>] [-Exclude <String[]>] [-Scope <String>] [<CommonParameters>]Get-Alias [-Exclude <String[]>] [-Scope <String>] [-Definition <String[]>] [<CommonParameters>]
Get all aliases in the current session
Get-AliasIdentifyGet aliases by name
Get-Alias -Name gp*, sp* -Exclude *psIdentifyGet aliases for a cmdlet
Get-Alias -Definition Get-ChildItemIdentifyGet aliases by property
Get-Alias | Where-Object {$_.Options -match "ReadOnly"}IdentifyGet aliases by name and filter by beginning letter
Get-Alias -Definition "*-PSSession" -Exclude e* -Scope GlobalIdentifyIts page in the reference: Get-Alias.
Parameters
-DefinitionGets the aliases for the specified item. Enter the name of a cmdlet, function, script, file, or executable file.
This parameter is called Definition, because it searches for the item name in the Definition property of the alias object.-ExcludeOmits the specified items. The value of this parameter qualifies the Name and Definition parameters. Enter a name, a definition, or a pattern, such as "s*". Wildcards are permitted.-NameSpecifies the aliases that this cmdlet gets. Wildcards are permitted. By default, Get-Alias retrieves all aliases defined for the current session. The parameter name Name is optional. You can also pipe alias names to Get-Alias.-ScopeSpecifies the scope for which this cmdlet gets aliases. The acceptable values for this parameter are:
- Global
- Local
- Script
- 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 information, see about_Scopes.