Skip to content
shellmap

reniceRe-prioritize a running process in bash, zsh, fish, PowerShell, and cmd across all 5 shells

Equivalents in every shell

Bashunix
renice -n 10 -p 1234

`-n N` new niceness, `-p PID` target. Without `-p` the default target is the PID; `-g GID` targets a process group; `-u USER` all processes owned by a user. Can only LOWER priority (increase niceness) for non-root users; raising priority (negative niceness) needs `CAP_SYS_NICE`.

Zshunix
renice -n 10 -p 1234

Same external `renice` from util-linux on Linux, BSD on macOS. macOS `renice` accepts `renice 10 -p 1234` (no `-n` flag) — for portability use `renice -n 10 -p 1234` which works on both.

Fishunix
renice -n 10 -p 1234

Same external. Useful fish-isms: `renice -n 10 -p (pgrep -d, ffmpeg)` re-prioritizes every ffmpeg process at once (the comma-delimited PIDs feed into `renice -p PID1,PID2,…`).

PowerShellwindows
(Get-Process -Id 1234).PriorityClass = "BelowNormal"

Direct property assignment on the `[Process]` object. Class accepts `Idle` / `BelowNormal` / `Normal` / `AboveNormal` / `High` / `RealTime`. For bulk: `Get-Process firefox | ForEach-Object { $_.PriorityClass = "BelowNormal" }`. Process objects are LIVE references — the assignment effects an immediate WIN32 `SetPriorityClass` call.

cmd.exewindows
wmic process where ProcessId=1234 CALL setpriority 16384

No built-in `renice`. WMIC priority values: `64` Idle, `16384` BelowNormal, `32` Normal, `32768` AboveNormal, `128` High, `256` RealTime. WMIC is deprecated since Windows 11 24H2 but still ships; for forward-compat use `powershell -Command "(Get-Process -Id 1234).PriorityClass = 'BelowNormal'"`.

Worked examples

Lower priority of a runaway process to free CPU for interactive use

Bash
renice -n 19 -p $(pgrep -f offending-script)
PowerShell
(Get-Process offending-script).PriorityClass = "Idle"
cmd.exe
wmic process where Name="offending-script.exe" CALL setpriority 64

Raise priority of an already-running process (requires root / Administrator)

Bash
sudo renice -n -10 -p 1234
PowerShell
Start-Process powershell -Verb RunAs -ArgumentList '-Command "(Get-Process -Id 1234).PriorityClass = `"High`""'

Re-prioritize ALL processes owned by a user (e.g. throttle the `nightly-build` user account)

Bash
sudo renice -n 15 -u nightly-build
PowerShell
Get-CimInstance Win32_Process | Where-Object { $_.GetOwner().User -eq "nightly-build" } | ForEach-Object { (Get-Process -Id $_.ProcessId).PriorityClass = "BelowNormal" }

Gotchas

  • Non-root users can only INCREASE niceness (lower priority). Once you renice down (e.g. `renice -n 10`), you can NOT renice back up (`renice -n 5`) without root — niceness changes are one-way for unprivileged users. To regain priority you'd need to relaunch the process. Plan accordingly.
  • Linux niceness lives on the THREAD level by default — bash `renice -n 10 -p PID` retargets the main thread. Multi-threaded processes have other threads at their original niceness. Use `renice -n 10 -t TID` (`-t` for TID, not PID) to target a specific thread; iterate over `/proc/PID/task/*` to renice all threads.
  • macOS BSD `renice` lacks `--all` and the `-u USER` form works differently — it renames ALL processes owned by the user including pid 1's children, which can include critical OS daemons. Always combine with `-p PID` for surgical changes on macOS.
  • pwsh `(Get-Process X).PriorityClass = "BelowNormal"` raises an exception if the target process has already exited between the `Get-Process` call and the assignment (race). Wrap with `try`/`catch` for resilient bulk-reprioritization scripts.
  • WMIC is being removed from Windows — `optionalfeatures.exe` lets users uninstall the "WMIC" component on Win11 24H2. Long-lived scripts should switch to `powershell -Command "(Get-Process -Id PID).PriorityClass = \"BelowNormal\""` (or call `Set-CimInstance` via the CIM cmdlets) to remain functional on stripped-down systems.

WSL & PowerShell Core notes

pwsh`Get-Process | ForEach-Object { $_.PriorityClass = "BelowNormal" }` works identically on Windows / Linux / macOS pwsh — `.PriorityClass` is a .NET-level property. On Linux/macOS, pwsh maps `BelowNormal` to Linux nice ~10 internally; for fine-grained control on Linux, shell out to `renice -n N -p $PID`.
WSLWSL `renice` works for Linux-side processes only. For a Windows-side process, run a Windows command: `cmd.exe /c "wmic process where ProcessId=1234 CALL setpriority 16384"` or `pwsh.exe -c "(Get-Process -Id 1234).PriorityClass = \"BelowNormal\""`.

Common tasks using renice

Related commands