PowerShell as cmd.exe or Bash
Xah Lee, 2009-07
PowerShell provides many aliases that emulates cmd.exe or Bash. So, if you are familiar with cmd.exe or bash, you can start using PowerShell as replacement. Here's a table showing some of the equivalent commands:
Path Manipulation
| PowerShell Cmdlet | PowerShell alias | cmd.exe | bash | Purpose |
| Set-Location | sl, cd, chdir | cd, chdir | cd | Change dir |
| Get-Location | gl, pwd | cd | pwd | Show current dir |
| Get-ChildItem | gci, dir, ls | dir | ls | List current dir content |
| Push-Location | pushd | pushd | pushd | Save current path to stack |
| Pop-Location | popd | popd | popd | Change to last pushed dir |
File Manipulation
| PowerShell Cmdlet | PowerShell alias | cmd.exe | bash | Purpose |
| Copy-Item | cpi, copy, cp | copy | cp | Copy file or dir |
| Remove-Item | ri, del, erase, rmdir, rd, rm | del, erase, rmdir, rd | rm, rmdir | Delete file or dir |
| Rename-Item | rni, ren | ren, rename | mv | Rename file or dir |
| Move-Item | mi, move, mv | move | mv | Move file or dir |
Text Processing
| PowerShell Cmdlet | PowerShell alias | cmd.exe | bash | Purpose |
| Get-Content | gc, type, cat | type | cat | Get file content |
| Select-String | ◇ | find, findstr | grep | Show texts matching a pattern |
env var Manipulation
| PowerShell Cmdlet | PowerShell alias | cmd.exe | bash | Purpose |
| Write-Output | echo, write | echo | echo | Print strings, variables etc. to standard output |
| Set-Variable | sv, set | set | set | Set the value of a variable / create a variable |
Process Management
| PowerShell Cmdlet | PowerShell alias | cmd.exe | bash | Purpose |
| Get-Process | gps, ps | tlist, tasklist | ps | List all currently running processes |
| Stop-Process | spps, kill | kill, taskkill | kill | Stop a running process |
Help Facilities
| PowerShell Cmdlet | PowerShell alias | cmd.exe | bash | Purpose |
| Clear-Host | cls, clear | cls | clear | Clear the screen |
| Get-Help | help, man | help | man | Help on commands |
Not Case Sensitive
PowerShell commands are not case sensitive. “dir” is same as “DIR” or “DiR”; “Get-ChildItem” is the same as “get-childitem” or “get-childITEM”.
Was this page useful? If so, please do donate $3, thank you
donors!
2009-07
© 2009 by Xah Lee.