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:
alias | cmdlet |
---|---|
%, foreach | For-EachObject |
?, where | Where-Object |
cat, gc, type | Get-Content |
cd, chdir, sl | Set-Location |
cls, clear | Clear-Host |
cp, copy, cpi | Copy-Item |
dir/ls/gci | Get-ChildItem |
echo, write | Write-Output |
fl | Format-List |
ft | Format-Table |
fw | Format-Wide |
gc, pwd | Get-Location |
gm | Get-Member |
iex | Invoke-Expression |
ii | Invoke-Item |
mv, move | Move-Item |
rm, rmdir, del, erase, rd, ri | Remove-Item |
sleep | Start-Sleep |
start, saps | Start-Process |
In the table above, you can see how aliases enabled simulating commands known from other environments (cmd, bash), hence increased discoverability.