renice Command Cheat Sheet
renice alters the scheduling priority of one or more running processes.
Priority Range: -20 (Highest) to +19 (Lowest).
Synopsis
renice [-n] PRIORITY [-g|-p|-u] IDENTIFIER...
Basic Usage
Renice by PID (-p)
Change priority of process 1234 to 5 (Lower priority).
renice -n 5 -p 1234
Increase Priority (Root Only)
Change priority to -10 (High priority).
sudo renice -n -10 -p 1234
Bulk Renice
Renice by User (-u)
Change priority of ALL processes owned by user alice.
sudo renice -n 10 -u alice
Renice by Process Group (-g)
Change priority of a process group.
renice -n 5 -g 500
Real World Usage
Scenario: A backup script is successfully running but slowing down the server.
1. Find PID: pgrep backup.sh -> 999
2. Make it nice: renice -n 19 -p 999
3. Now it runs only on idle CPU time.
Notes
- Absolute Values: Unlike
nice(which might add to current value),renicesets the absolute priority.renice -n 5 -p 1234sets the value to 5, regardless of what it was before.
- Permissions: You can modify your own processes (make them nicer). You need
rootto modify other users' processes or to make any process "less nice" (negative value).