An alias is an alternate name, nickname, or shorthand reference assigned to a cmdlet, function, script, or executable file. PowerShell includes built-in aliases to help administrators transition from Unix shells (Bash) and Windows Command Prompt (cmd.exe), as well as cmdlets to create and manage custom aliases.
PowerShell ships with many built-in aliases, including familiar names from Bash (ls, cat, rm) and Command Prompt (dir, copy, del), to ease the transition for users coming from other shells.
Inspecting Aliases with Get-Alias
The Get-Alias cmdlet (alias: gal) inspects the aliases registered in your active PowerShell session.
Finding the Target of an Alias
To find out what cmdlet or executable an alias points to, pass the alias name directly:
Get-Alias -Name "dir", "ls", "cat"CommandType Name Version Source
----------- ---- ------- ------
Alias dir -> Get-ChildItem
Alias ls -> Get-ChildItem
Alias cat -> Get-Contentwhere:
-Name lslooks up the specific aliasls.- The output shows
lsresolves to theGet-ChildItemcmdlet.
To see every alias currently defined in the session, run Get-Alias with no parameters:
Get-Alias | Select-Object -First 5CommandType Name Version Source
----------- ---- ------- ------
Alias % -> ForEach-Object
Alias ? -> Where-Object
Alias ac -> Add-Content
Alias cat -> Get-Content
Alias cd -> Set-LocationReverse Lookup: Finding Aliases for a Cmdlet
You can also search in the reverse direction, finding all aliases that point to a specific cmdlet, using the -Definition parameter:
Get-Alias -Definition Get-ChildItemCommandType Name Version Source
----------- ---- ------- ------
Alias dir -> Get-ChildItem
Alias gci -> Get-ChildItem
Alias ls -> Get-ChildItemCommon Built-In Aliases
PowerShell provides standard aliases that mirror traditional command names from Bash and Command Prompt:
| Traditional Command | PowerShell Alias Target | Purpose / Action |
|---|---|---|
dir / ls |
Get-ChildItem |
Lists items in a directory or provider path |
cd / chdir |
Set-Location |
Changes the current working directory |
copy / cp |
Copy-Item |
Copies files, directories, or registry items |
move / mv |
Move-Item |
Moves or renames files and containers |
del / rm / erase |
Remove-Item |
Deletes files, directories, or variables |
cat / type |
Get-Content |
Reads and outputs the contents of a text file |
cls / clear |
Clear-Host |
Clears the terminal screen buffer |
ps |
Get-Process |
Queries active system processes |
kill |
Stop-Process |
Terminates one or more processes by ID or name |
man / help |
Get-Help |
Opens command documentation and syntax help |
pwd |
Get-Location |
Displays the current working directory |
echo |
Write-Output |
Writes objects to the pipeline |
Creating and Managing Aliases: Set-Alias and New-Alias
PowerShell provides two cmdlets for defining aliases:
New-Alias: Creates an alias. If the alias already exists, it throws an error unless-Forceis specified.Set-Alias(alias:sal): Creates an alias if it does not exist, or overwrites it if it does. This is generally preferred.
Set-Alias
Set-Alias creates a new alias, or overwrites an existing one if the name is already in use.
Set-Alias -Name gp -Value Get-Process
gpwhere:
-Name gpdefines the alias name.-Value Get-Processspecifies the cmdlet the alias points to.
NPM(K) PM(M) WS(M) CPU(s) Id SI ProcessName
------ ----- ----- ------ -- -- -----------
45 210.34 315.67 45.22 8192 1 chromeNew-Alias
New-Alias creates a new alias but throws an error if the alias name already exists, preventing accidental overwrites.
New-Alias -Name gp -Value Get-ProcessNew-Alias : An alias with the name 'gp' already exists.Defining a Simple Alias
Set-Alias -Name "gh" -Value Get-Help
Set-Alias -Name "np" -Value "$env:SystemRoot\notepad.exe"Removing an Alias
To delete an alias from the current session, use Remove-Alias or delete it from the Alias: PSDrive using Remove-Item:
Remove-Alias -Name "gh"
Remove-Item -Path "Alias:\np"The Parameter Limitation of Aliases
An alias in PowerShell is strictly an alternate name for a command. You cannot include parameters or arguments in an alias definition.
Set-Alias -Name "ll" -Value "Get-ChildItem -Force"If you need a shortcut that includes default parameters, write a wrapper function instead:
function ll { Get-ChildItem -Force $args }where $args passes any additional arguments passed to ll directly through to Get-ChildItem.
Aliases can also point to custom functions, not just built-in cmdlets:
function Get-DiskSummary {
Get-Volume | Select-Object DriveLetter, SizeRemaining, Size
}
Set-Alias -Name disksum -Value Get-DiskSummary
disksum./custom-function-alias.ps1DriveLetter SizeRemaining Size
----------- ------------- ----
C 123456789012 512110190592Persisting Aliases via PowerShell Profile
Aliases created at the command line exist only in memory for the lifetime of that session. When you close the terminal, all custom aliases are lost.
To make custom aliases available in every new session, add them to your PowerShell Profile script ($PROFILE).
Step 1: Open the Profile
Locate and edit the profile file stored in the $PROFILE variable:
if (-not (Test-Path -Path $PROFILE)) {
New-Item -ItemType File -Path $PROFILE -Force | Out-Null
}
notepad.exe $PROFILEFor more details on profile scopes and paths, see PowerShell Environment.
Step 2: Add Alias and Function Declarations
Append your custom shortcuts to the profile file:
Set-Alias -Name "np" -Value "$env:SystemRoot\notepad.exe"
Set-Alias -Name "sysinfo" -Value Get-ComputerInfo
Set-Alias -Name "gs" -Value Get-Service
Set-Alias -Name "gp" -Value Get-Process
Set-Alias -Name "disksum" -Value Get-DiskSummary
function ll { Get-ChildItem -Force -Color $args }
function grep { Select-String $args }where Each Set-Alias line runs automatically every time a new PowerShell session starts, since it's part of the profile script.
Save and close the file. The aliases and functions will now load automatically whenever you launch PowerShell.
Practical Example: Managing and Exporting Session Aliases
The following script audits the current session for custom aliases, exports them to a configuration file, and demonstrates how to handle shortcuts that require default parameters:
Set-Alias -Name "procs" -Value Get-Process
function Search-LogFiles {
param([string]$Pattern)
Get-ChildItem -Path "$env:TEMP" -Filter "*.log" -Recurse |
Select-String -Pattern $Pattern
}
Set-Alias -Name "slog" -Value Search-LogFiles
$TargetAliases = "procs", "slog"
$Report = foreach ($aliasName in $TargetAliases) {
$aliasItem = Get-Alias -Name $aliasName -ErrorAction SilentlyContinue
if ($aliasItem) {
[PSCustomObject]@{
AliasName = $aliasItem.Name
TargetCommand = $aliasItem.Definition
CommandCategory = (Get-Command -Name $aliasItem.Definition).CommandType
CreatedDate = (Get-Date -Format "yyyy-MM-dd")
}
}
}
$Reportwhere:
Set-Alias -Name "procs" -Value Get-Processcreates a standard command alias.function Search-LogFileswraps a multi-parameter command so it can be called with default behavior, and is then aliased toslog.Get-Alias -Name $aliasNamequeries the alias objects directly.(Get-Command -Name $aliasItem.Definition).CommandTyperesolves whether the target is aCmdletor aFunction.
Execute the script from the console:
pwsh ./manage-session-aliases.ps1AliasName TargetCommand CommandCategory CreatedDate
--------- ------------- --------------- -----------
procs Get-Process Cmdlet 2026-09-27
slog Search-LogFiles Function 2026-09-27