PowerShell Cheat Sheet
Searchable reference for everyday PowerShell cmdlets.
| Cmdlet | Description |
|---|---|
| Get-ChildItem | List items (alias: ls, dir) |
| Set-Location | Change directory (alias: cd) |
| Get-Location | Print working directory (alias: pwd) |
| New-Item -Type Directory p | Create folder |
| Remove-Item -Recurse -Force p | Recursive delete |
| Copy-Item -Recurse a b | Copy folder |
| Move-Item a b | Move / rename |
| Get-Content <file> | Read file (alias: cat) |
| Select-String 'pat' f | Grep equivalent |
| Get-Process | ? Name -like '*app*' | Find process |
| Stop-Process -Id 1234 -Force | Kill process |
| Get-PSDrive | List filesystem-like drives |
| $env:VAR = 'value' | Set env var |
| Get-Help <cmd> | Show help |
| Invoke-WebRequest -Uri url | HTTP fetch (alias: curl) |
| ConvertFrom-Json | Parse JSON string |
| ConvertTo-Json | Serialise to JSON |
| ForEach-Object { ... } | Pipeline loop |
| Where-Object { $_.Foo -eq 1 } | Pipeline filter |
| Select-Object -First 5 | Take first N |
| Sort-Object Foo -Descending | Sort by property |
| Measure-Object -Line | Count lines |
| Compress-Archive a -DestinationPath a.zip | Make zip |
| Expand-Archive a.zip -DestinationPath . | Extract zip |
| Test-Path <path> | Does it exist? |
| Get-Command <name> | Find a command |
| Get-Member | Inspect object members |
| Out-File -FilePath f -Encoding utf8 | Write file as UTF-8 |
| Start-Process -Verb RunAs | Run elevated |
About this tool
Verb-Noun cmdlets for file system, process, pipeline, archives and HTTP — with one-line descriptions and common aliases.