PowerShell cmdlets are famous for their descriptive names like Get-ChildItem or Set-Location. While this makes commands easy to understand, typing long names repeatedly during daily tasks can slow you down. That is where PowerShell Aliases come to the rescue.
What is a PowerShell Alias?
An alias is simply a nickname or a quick speed-dial shortcut for a longer cmdlet. In fact, if you have ever typed dir or ls in PowerShell and noticed it worked just like Command Prompt or Linux, you were already using built-in aliases!
Discovering Built-In Aliases
You can check which aliases already exist on your system using the Get-Alias cmdlet:
# List all aliases currently available
Get-Alias
# Find out what long command the short name 'cls' actually runs
Get-Alias cls
# Output:
# CommandType Name Version Source
# ----------- ---- ------- ------
# Alias cls -> Clear-HostCreating Your Own Aliases
Want to create your own shortcuts? Use Set-Alias to link a short word to any cmdlet:
# Create a shortcut 'np' to launch Notepad instantly
Set-Alias -Name np -Value notepad.exe
# Create a shortcut 'myip' to check network configuration
Set-Alias -Name myip -Value ipconfigNow, whenever you type np and press Enter, Windows Notepad pops up instantly!
3 Things to Remember
- Aliases are Nicknames: They do not replace cmdlets; they just provide a shorter, faster way to trigger them.
- Inspect with Get-Alias: If you are unsure what a mystery 2-letter command does, run
Get-Alias <name>to reveal its true identity. - Cross-Platform Compatibility: Common aliases like
ls,cp, andmvexist out-of-the-box so command-line users feel right at home.