top — Interactive process viewer — running processes sorted by CPU across all 5 shells
Equivalents in every shell
toptoptopGet-Process | Sort-Object CPU -Descending | Select-Object -First 20PowerShell has no interactive `top`. This snapshot is the closest one-liner; wrap it in `while ($true) { Clear-Host; ...; Start-Sleep 2 }` for refresh. Windows ships Task Manager (`taskmgr`) as the GUI equivalent.
tasklistcmd has no auto-refreshing process viewer — `tasklist` is a snapshot. Wrap in `for /l %i in () do @(cls & tasklist)` to loop, or open Task Manager (`taskmgr`).
Worked examples
Sort by memory instead of CPU
top -o %MEMGet-Process | Sort-Object WorkingSet64 -Descending | Select-Object -First 20tasklist /v /fo table | sort /+65 /rRefresh every 2 seconds
top -d 2while ($true) { Clear-Host; Get-Process | Sort-Object CPU -Desc | Select-Object -First 20; Start-Sleep 2 }Show only one user’s processes
top -u aliceGet-Process -IncludeUserName | Where-Object UserName -like "*alice*"tasklist /fi "username eq alice"Gotchas
- Linux `top` (procps-ng) and macOS / BSD `top` accept different flags — `top -o cpu` works on macOS, `top -o %CPU` on Linux. `htop` and `btop` are popular drop-in replacements with sane defaults.
- Quit with `q` (lowercase); `Ctrl+C` also works but is rough. Inside `top`, press `M` to sort by memory, `P` for CPU.
- `Get-Process` cannot show CPU usage *rate* — the `CPU` column is total CPU-seconds since the process started. For a live rate, use `Get-Counter "\Process(*)\% Processor Time"`.
- `Get-Process -IncludeUserName` requires an elevated PowerShell session on Windows; without it the column is blank.
WSL & PowerShell Core notes
Common tasks using top
- Find processes using the most CPU
List the top CPU-consuming processes — useful for performance triage, runaway-script detection, and capacity planning.
- Get the memory usage of a specific process
Read the RAM footprint of one running PID — RSS, virtual size, or proportional share — for sizing investigations, leak hunts, and "is this process growing" longitudinal checks.
- Kill a process by name
Terminate every running process whose executable matches a given name.
- Monitor CPU and memory live
Watch CPU and memory utilisation continuously from a shell — for triage, capacity planning, and detecting transient spikes that a one-shot ps would miss.
- Show the process tree
Render the parent/child relationships between running processes — useful for tracing rogue children, debugging fork bombs, and understanding shell-spawned subprocess chains.
- Show the top processes by memory usage
Identify which running processes consume the most RAM — for debugging memory pressure, leak hunts, or "what is eating my laptop".