renice — Re-prioritize a running process in bash, zsh, fish, PowerShell, and cmd across all 5 shells
Equivalents in every shell
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`.
renice -n 10 -p 1234Same 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.
renice -n 10 -p 1234Same 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,…`).
(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.
wmic process where ProcessId=1234 CALL setpriority 16384No 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
renice -n 19 -p $(pgrep -f offending-script)(Get-Process offending-script).PriorityClass = "Idle"wmic process where Name="offending-script.exe" CALL setpriority 64Raise priority of an already-running process (requires root / Administrator)
sudo renice -n -10 -p 1234Start-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)
sudo renice -n 15 -u nightly-buildGet-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.