Getting aliases
In this recipe, we take a look at aliases in PowerShell.
How to do it...
Let's check out aliases in PowerShell:
- Open PowerShell ISE as an administrator.
- Add the following script and run it:
#list all aliases Get-Alias #get members of Get-Alias Get-Alias | Get-Member #list cmdlet that is aliased as dir $alias:dir #list cmdlet that is aliased as ls $alias:ls #get all aliases of Get-ChildItem Get-Alias -Definition "Get-ChildItem"
How it works...
An alias in PowerShell is a different name that you can use for a cmdlet. Some cmdlets already come with a handful of aliases, but you can create your own aliases for cmdlets as well.
The Get-Alias
returns all PowerShell aliases. PowerShell's building blocks are cmdlets that are named using the
Get SQL Server 2014 with PowerShell v5 Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.