PowerShell Basics
Learn PowerShell's verb-noun cmdlets and object-based approach to automation.
PowerShell is a cross-platform shell and scripting language built on .NET. Its
commands are cmdlets named with a consistent Verb-Noun pattern
(Get-Process, Set-Item, Remove-Item) so they’re discoverable and predictable.
The big idea that sets it apart from Bash: the pipeline passes objects, not
text. Get-Process returns rich process objects with properties you can filter
and sort directly — no fragile text parsing with awk/sed.
- Variables start with
$:$name = "Alex" - Discover anything with
Get-Command,Get-Help,Get-Member - Aliases ease the transition:
ls,cd,catmap to cmdlets
Get-Process | Sort-Object CPU -Descending | Select-Object -First 5
Get-ChildItem -Recurse -Filter *.log | Measure-Object -Property Length -Sum
$name = "Alex"
Write-Output "Hello, $name"
Get-Service | Where-Object Status -eq 'Running'
Get-Process | Get-Member # discover available properties/methods - Use
Get-Processto list the five processes using the most memory. - Find every cmdlet containing “Service” with
Get-Command *Service*. - Pipe a cmdlet into
Get-Memberand read its properties. - Store a value in a variable and interpolate it in a string.
Cheat Sheet▾
| Task | Cmdlet |
|---|---|
| List processes | Get-Process |
| List files | Get-ChildItem |
| Filter | Where-Object { … } |
| Pick columns | Select-Object |
| Sort | Sort-Object |
| Aggregate | Measure-Object |
| Discover | Get-Command, Get-Help, Get-Member |
Common Interview Questions▾
How does the PowerShell pipeline differ from Bash?
PowerShell passes structured .NET objects between cmdlets, so you filter and sort by named properties. Bash pipes plain text that must be parsed with tools like awk.
What is the naming convention for cmdlets?
Verb-Noun, like Get-Process or Remove-Item, which makes commands consistent and discoverable via Get-Command and Get-Verb.