This guide will elaborate on the “Get-Alias” cmdlet in PowerShell.
How to Use the Get-Alias (Microsoft.PowerShell.Utility) Cmdlet in PowerShell?
The cmdlet “Get-Alias” is utilized to retrieve the alias names for the cmdlets in PowerShell. Let’s have a look at the given examples to learn the usage of the stated cmdlet.
Example 1: Use the “Get-Alias” Cmdlet to Retrieve All the Aliases
Execute the given command to retrieve the current session’s aliases:
Example 2: Use the Cmdlet “Get-Alias” to Get Aliases by Name
First, use the “Get-Alias” cmdlet. Then, write the “-Name” parameter and specify the provided names along with the wild character “*” to display the selected aliases:
Example 3: Use the “Get-Alias” Cmdlet to Get an Alias for a Specific Cmdlet
To get a cmdlet’s alias, first, use the “Get-Alias” cmdlet. Then, specify the “-Definition” parameter and provide it with the below-mentioned cmdlet:
Example 4: Use the “Get-Alias” Cmdlet to Get an Alias by Name and Filter it Using a Predefined Name
Initially, use the “Get-Alias” cmdlet. Then, write the “-Definition” parameter and specify the stated value along with the wild character “*” at the start. Lastly, use the “-Scope” parameter and assign the “Local” value to the scope:
That’s it! You have learned the usage of the “Get-Alias” cmdlet in PowerShell.
Conclusion
PowerShell’s “Get-Alias” cmdlet gets the alias names of the cmdlets in the current session only. It gets aliases of the cmdlets, functions, or scripts. This post illustrated the “Get-Alias” cmdlet with the help of various examples.