Skip to content
shellmap

topInteractive process viewer — running processes sorted by CPU across all 5 shells

Equivalents in every shell

Bashunix
top
Zshunix
top
Fishunix
top
PowerShellwindows
Get-Process | Sort-Object CPU -Descending | Select-Object -First 20

PowerShell 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.

cmd.exewindows
tasklist

cmd 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

Bash
top -o %MEM
PowerShell
Get-Process | Sort-Object WorkingSet64 -Descending | Select-Object -First 20
cmd.exe
tasklist /v /fo table | sort /+65 /r

Refresh every 2 seconds

Bash
top -d 2
PowerShell
while ($true) { Clear-Host; Get-Process | Sort-Object CPU -Desc | Select-Object -First 20; Start-Sleep 2 }

Show only one user’s processes

Bash
top -u alice
PowerShell
Get-Process -IncludeUserName | Where-Object UserName -like "*alice*"
cmd.exe
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

pwshPowerShell Core has no built-in `top` cmdlet on any platform. `Get-Process | Sort-Object CPU -Descending | Select-Object -First 20` produces a snapshot that works identically on Windows, macOS, and Linux pwsh, but it is not interactive.
WSL`top` inside WSL only lists Linux processes. To see Windows processes from inside WSL, call `tasklist.exe` (or `pwsh.exe -c "Get-Process"`) through interop. Conversely, Task Manager on Windows does not list WSL-internal processes; only the `vmmem` / `wslservice` host shows up.

Common tasks using top

Related commands