get-process — PowerShell's process-listing cmdlet — the ps equivalent across all 5 shells
Equivalents in every shell
ps -efPOSIX `ps` lists processes as TEXT — column shape varies by `-o` format string. `ps -eo pid,user,comm,args,%cpu` is a common scriptable form; `ps -ef` is the classic System V style; `ps aux` is BSD-style. Output is one line per process — downstream parsing uses `awk`, `sort`, `grep`.
ps -efSame external `/bin/ps`. macOS `ps` is BSD-derived — `ps aux` and `ps -ef` both work; `ps -eo` accepts different column names than Linux (`stime` vs `start_time`). Cross-platform scripts should constrain to `pid`, `user`, `comm`, `args`, `pcpu`, `pmem` — the intersection.
ps -efSame external. Fish has no built-in process inspector. For just-this-shell's child processes use `jobs` (fish-builtin) — NOT the same as full `ps`; `jobs` only sees backgrounded jobs of the current shell.
Get-ProcessPowerShell-native cmdlet (aliases `gps`, `ps`). Returns `[System.Diagnostics.Process]` OBJECTS — `.WorkingSet64`, `.CPU`, `.Path`, `.StartTime`, `.MainModule.FileVersionInfo` are direct property reads. `-Name` and `-Id` filter at the cmdlet level; `-IncludeUserName` adds the owner column but requires elevation.
tasklistBuilt-in process snapshot. `tasklist /v` adds the window title and user; `/svc` lists services per process; `/fi "imagename eq node.exe"` filters by name. Output is fixed-width text — no object piping. For PID-by-port, cross-reference `netstat -ano` output.
Worked examples
List all running processes
ps -efGet-ProcesstasklistFind the top 10 CPU-consuming processes
ps aux --sort=-%cpu | head -11Get-Process | Sort-Object CPU -Descending | Select-Object -First 10 Name, Id, CPUtasklist /v /fo csv | sortFind a process by name (wildcard)
pgrep -fl nginxGet-Process -Name nginx*tasklist /fi "imagename eq nginx.exe"Gotchas
- `Get-Process`'s `.CPU` property is TOTAL CPU-SECONDS since the process started, NOT a live percentage. For a percent-over-window reading, sample twice with `Start-Sleep` and divide deltas, or use `Get-Counter '\Process(*)\% Processor Time'`. This is the most common surprise for `top` / `htop` muscle memory.
- `Get-Process -IncludeUserName` requires an ELEVATED PowerShell session — without admin, the UserName column is BLANK for everyone but the calling user, and no error is raised. Linux `ps -eo user,comm` shows owners without elevation; cross-platform scripts that filter by user need an `if (-not (IsAdmin)) { throw ... }` guard on the Windows path.
- Reading `.Path` or `.MainModule` for processes you don't own throws `Access denied` even as admin if the process is a PROTECTED one (System, services running as TrustedInstaller, antivirus). Wrap with `try { $_.Path } catch { '<protected>' }` when iterating over `Get-Process`.
- `(Get-Process -Id $pid).WaitForExit()` BLOCKS the entire pipeline indefinitely. To wait non-blockingly use the cmdlet `Wait-Process -Id <pid> -Timeout <sec>` — cancellable, returns a clear timeout error, integrates with `try/catch`. The `.WaitForExit()` method is fine in one-shot scripts but disastrous in PowerShell pipelines.
- The PowerShell alias `ps` for `Get-Process` collides with the Unix binary on pwsh Linux/macOS — `ps` resolves to the cmdlet FIRST. To call the real Unix `ps`, use the full path (`/bin/ps aux`) or remove the alias for the session (`Remove-Alias ps`). Scripts that target Unix pwsh should spell `Get-Process` (or `/bin/ps`) explicitly.
WSL & PowerShell Core notes
Common tasks using get-process
- Attach to the output of a running process
Read the stdout/stderr of an already-running process you did not launch — for debugging daemons, observing what a frozen-looking job is doing, and tailing logs that weren't redirected at start.
- Count the running processes
Report how many processes are alive — useful for load testing, capacity baselining, or detecting fork-bomb / runaway-parallelism conditions.
- Find a process ID by name
Look up the PID(s) of a running process given its executable name — the lookup that precedes most kill / signal / inspect operations.
- Find processes using the most CPU
List the top CPU-consuming processes — useful for performance triage, runaway-script detection, and capacity planning.
- Get how long a process has been running
Find the wall-clock age of a process — how long ago it started — for debugging stuck daemons, validating a recent restart, or pinning a leak to "this process has been up for 47 days".
- 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 all processes of a user
Terminate every process owned by a given user — useful for forced logout, cleanup, and runaway-session containment.
- Kill the process listening on a port
Find and terminate whatever process is bound to a TCP/UDP port — the answer to "address already in use" when a previous run did not release the socket.
- 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.
- Set process priority
Run a CPU-hungry job at lower priority so it does not steal cycles from interactive work — or, conversely, give a latency-sensitive job a priority boost.
- 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.
- Wait for a process to finish
Block until a given process exits — useful for sequencing, dependency-management scripts, and orchestrated shutdowns.