During the Cloud Expo convention in the Netherlands last month, I spoke to someone who said that learning all the PowerShell commands as a Linux admin was difficult. PowerShell was built to make it easier for Linux admins to transition to it. In this blog post, I will show you how aliases work and how they help Linux Admins get started with basic PowerShell tasks…
Aliases
From the start, PowerShell would let you use aliases for specific commands. There are many built-in ones, and you can add your own if you want to. To get a list of aliases, you can use the Get-Alias cmdlet, which will return the list of the currently configured aliases:

As shown above, the list will also show if a particular alias was added by installing a specific module. Az.Accounts, for example, add these:

Linux aliases
As you can see in the first screenshot, specific aliases that are available by default in Powershell are used in Linux. From the available aliases, these are similar to Linux commands:
| Linux command | PowerShell cmdlet | Description |
| cat | Get-Content | Show the contents of a file |
| cd | Set-Location | Change directory |
| clear | Clear-Host | Clear contents of the terminal screen |
| cp | Copy-Item | Copy a file to another file |
| dir | Get-ChildItem | Show the files and folders in current folder |
| echo | Write-Output | Output text to screen |
| history | Get-History | Retrieve the list of previously uses commands |
| kill | Stop-Process | Terminate a process |
| ls | Get-ChildItem | Show the files and folders in the current folder |
| man | help | Get help for a specific command |
| md | mkdir / New-Item | Create a folder, mkdir |
| mount | New-PSDrive | Mount a temporary or persistent drive or folder |
| mv | Move-Item | Move a file or folder to another location or rename it |
| popd | Pop-Location | Change current working directory |
| ps | Get-Process | Retrieve running processes |
| pushd | Push-Location | Save the current directory and move to another |
| pwd | Get-Location | Show current location |
| rm | Remove-Item | Remove file |
| rmdir | Remove-Item | Remove directory |
| sleep | Start-Sleep | Sleep for x seconds |
| sort | Sort-Object | Sort output |
| tee | Tee-Object | Write output to file from pipe |
It could be that I missed one, but these are the ones I know and also use in Linux myself 🙂
Best practices in using aliases
While aliases are excellent, typing fewer characters, you should always use the full PowerShell cmdlet in scripts, making it more readable. I wrote a blog post in the past with examples here.