PowerShell Aliases

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Remarks

Powershell naming system has quite strict rules of naming cmdlets (Verb-Noun template; see [topic not yet created] for more information). But it is not really convenient to write Get-ChildItems every time you want to list files in directory interactively.
Therefore Powershell enables using shortcuts - aliases - instead of cmdlet names.

You can write ls, dir or gci instead of Get-ChildItem and get the same result. Alias is equivalent to its cmdlet.

Some of the common aliases are:

aliascmdlet
%, foreachFor-EachObject
?, whereWhere-Object
cat, gc, typeGet-Content
cd, chdir, slSet-Location
cls, clearClear-Host
cp, copy, cpiCopy-Item
dir/ls/gciGet-ChildItem
echo, writeWrite-Output
flFormat-List
ftFormat-Table
fwFormat-Wide
gc, pwdGet-Location
gmGet-Member
iexInvoke-Expression
iiInvoke-Item
mv, moveMove-Item
rm, rmdir, del, erase, rd, riRemove-Item
sleepStart-Sleep
start, sapsStart-Process

In the table above, you can see how aliases enabled simulating commands known from other environments (cmd, bash), hence increased discoverability.



Got any PowerShell Question?