renice Command Guide for Changing a Running Process’s Priority
renice changes the niceness of a process that is already running — the mid-flight counterpart to nice.
What is renice, and Why Use It?
The renice command re-adjusts the niceness value of one or more running processes. You specify the target by process ID (-p), by running command name (-u), or by group of processes started by a user (-g). It is the tool you reach for when a program starts first and you change your mind later — a runaway backup that needs to become polite, or an urgent job that deserves more CPU than it currently has.
Why Learn renice?
- Fix priority mistakes: launched something too greedily?
renicebrings it back down without restarting it. - No restart cost: changing a running process’s priority takes effect instantly — no killing and relaunching.
- Find it by name:
-utargets every process owned by a user, so you do not need to hunt for PIDs first. - Pairs with
nice:niceat launch time,renicein flight — one concept, two commands.
reniceis the mid-flight steering wheel for CPU priority:nicedecides where a program starts,renicedecides where it ends up.
1. Basic Usage: Change by Process ID
# Lower the priority of PID 1234 (niceness 10 — very polite)
renice -n 10 -p 1234
# Raise the priority (needs root for negative values)
sudo renice -n -5 -p 1234
# Find the PID first if you do not know it
pgrep -f myscript.sh
The -n flag sets the absolute niceness value. Older syntax like renice 10 -p 1234 still works but is deprecated in favor of -n.
2. Change by User or by Process Group
# All processes owned by the user "buildbot"
renice -n 15 -u buildbot
# All processes started by user "alice" — note the % prefix
renice -n 15 -g %alice
# Combine with ps to find candidates first
ps -eo pid,ni,user,comm
-u user— every process owned by that user.-g grp— processes in that group; prefix a user name with%to mean “all processes of this user”.
3. Checking the Result
# Show PID, niceness, and command for everything
ps -eo pid,ni,comm
# Confirm one process changed
ps -o pid,ni,cmd -p 1234
The ni column in ps output shows the current niceness — 0 is the default, 19 is the politest.
4. Who Can Do What
| Change | Needs root? |
|---|---|
| Lower niceness (make more polite) | No — any user may do this to their own processes |
| Raise niceness within the current range | Usually yes |
| Raise niceness below 0 | Always yes |
| Touch another user’s process | Always yes |
The rule of thumb: you can always make your own programs more polite, but only root can make them greedier.
5. renice vs. nice
nice | renice | |
|---|---|---|
| When | Before the program starts | While it runs |
| Target | The command you launch | An existing process |
| Syntax | nice -n 10 command | renice -n 10 -p PID |
| Restart needed | N/A | No |
# nice: priority baked in at launch
nice -n 10 ./backup.sh &
# renice: same outcome, but you started the job first
./backup.sh &
renice -n 10 -p $!
Common Pitfalls
- Forgetting that
reniceneeds a target: unlikenice, it changes something existing — always pass-p,-u, or-g. - Negative values need root:
renice -n -5 -p 1234as a normal user silently fails or errors; usesudo. -umatches every process of that user: it is broad by design — double-check withps -ubefore renicing.- Nice values do not persist: they reset when the program restarts; bake long-term priority into a unit file or wrapper script.
Related Pages
| Page | Why It Matters |
|---|---|
nice | Set priority at launch — the launch-time half of the same idea. |
ps | Show the ni column to see current priorities. |
pgrep | Find the PIDs you want to re-nice. |
top | Watch priority-driven scheduling live (r key renices interactively). |
renice Cheatsheet
| Command | What It Does |
|---|---|
renice -n 10 -p 1234 | Make PID 1234 polite. |
sudo renice -n -5 -p 1234 | Make PID 1234 greedy (needs root). |
renice -n 15 -u buildbot | Re-nice every process owned by a user. |
renice -n 15 -g %alice | Re-nice every process started by user alice. |
ps -eo pid,ni,comm | Check current niceness values. |
ps -o pid,ni,cmd -p PID | Check one process. |