An alias is a short nickname for a PowerShell cmdlet. Instead of typing the full cmdlet name every time, an alias lets you type a shorter version that does the same thing. PowerShell ships with dozens of built-in aliases, and you can create your own for any cmdlet you use frequently.
What Is an Alias?
Think of an alias like a speed-dial button on a phone. Pressing button 1 automatically dials a number you use all the time — you did not change the phone number, just the way you access it. An alias is the same idea: a short label that points to a full cmdlet.
Alias → Full Cmdlet
----- -----------
ls → Get-ChildItem
cd → Set-Location
cls → Clear-Host
dir → Get-ChildItem
echo → Write-Output
pwd → Get-Location
rm → Remove-Item
cp → Copy-Item
mv → Move-Item
cat → Get-Content
man → Get-Help
ps → Get-Process
kill → Stop-Process
Viewing Built-in Aliases
# List all aliases in the current session
Get-Alias
# Find the alias for a specific cmdlet
Get-Alias -Definition Get-ChildItem
# Find what a specific alias points to
Get-Alias ls
Sample Output of Get-Alias ls
CommandType Name Version Source
----------- ---- ------- ------
Alias ls -> Get-ChildItem
Creating a New Alias
Use
New-Alias to create an alias for the current session.
# Create an alias "npp" for Notepad++
New-Alias -Name npp -Value notepad
# Now open notepad by typing just npp
npp
# Create an alias for a frequently used cmdlet
New-Alias -Name svc -Value Get-Service
# Use the alias
svc # Lists all services — same as Get-Service
Important Rules for New-Alias
| Rule | Detail |
|---|
| Points to cmdlets only | Cannot alias a cmdlet with parameters — use a function for that |
| One alias per name | An alias name cannot already exist (use Set-Alias to update) |
| Session only | Alias is lost when the session closes unless saved to a profile |
Updating an Existing Alias
Set-Alias creates an alias if it does not exist, or updates it if it does — making it safer than
New-Alias in scripts.
# Redirect the alias "np" to Write-Output
Set-Alias -Name np -Value Write-Output
np "Hello from alias" # Output: Hello from alias
Alias vs Function — When to Use Which
An alias only points to a cmdlet name. It cannot include parameters or logic. Use a function when you need to package a cmdlet with specific parameters.
# Alias — points to cmdlet name only
New-Alias -Name procs -Value Get-Process
# Function — cmdlet + parameters + logic
function Get-TopProcesses {
Get-Process | Sort-Object CPU -Descending | Select-Object -First 10
}
Alias Function
----- --------
Short name only Can include parameters
No logic Can include conditions and loops
Fast to create More flexible
One word Multiple lines of code
Removing an Alias
# Remove an alias from the current session
Remove-Item Alias:svc
# Alternative
Remove-Item -Path Alias:\np
Exporting and Importing Aliases
# Export all current aliases to a CSV file
Export-Alias -Path "C:\MyAliases.csv"
# Import aliases from a file into a new session
Import-Alias -Path "C:\MyAliases.csv"
Making Aliases Permanent with a Profile
By default, aliases created with
New-Alias disappear when PowerShell closes. Add them to the PowerShell profile file to load them automatically every session.
# Step 1: Open your profile file for editing (creates it if it doesn't exist)
notepad $PROFILE
# Step 2: Add your aliases inside the profile file
New-Alias -Name gs -Value Get-Service
New-Alias -Name gp -Value Get-Process
New-Alias -Name np -Value notepad
# Step 3: Save the file and restart PowerShell
# Your aliases are now available in every new session
Profile File Locations
| Profile Variable | Scope | Path Example |
|---|
$PROFILE | Current user, current host | C:\Users\Alice\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 |
$PROFILE.AllUsersAllHosts | All users, all hosts | C:\Program Files\PowerShell\7\profile.ps1 |
Alias Visibility Diagram
+----------------------------+
| PowerShell Session Start |
+----------------------------+
|
v
+----------------------------+
| Built-in Aliases Load | ← ls, cd, dir, cls, etc.
+----------------------------+
|
v
+----------------------------+
| Profile File Loads | ← Your custom aliases
+----------------------------+
|
v
+----------------------------+
| You Create More Aliases | ← New-Alias or Set-Alias
+----------------------------+
|
v
+----------------------------+
| Session Ends |
| Custom (non-profile) |
| aliases are gone |
+----------------------------+
Listing All Aliases Alphabetically
Get-Alias | Sort-Object Name | Format-Table Name, Definition -AutoSize
Sample Output
Name Definition
---- ----------
cat Get-Content
cd Set-Location
cls Clear-Host
cp Copy-Item
dir Get-ChildItem
echo Write-Output
ls Get-ChildItem
mv Move-Item
ps Get-Process
pwd Get-Location
rm Remove-Item
Summary
Aliases are short names for longer cmdlets. PowerShell includes many familiar aliases from Linux and Windows CMD so beginners feel at home. Create custom aliases with
New-Alias or
Set-Alias, and save them in your profile for permanent access. When a task needs more than a simple alias — parameters, conditions, or logic — write a function instead.