renice — Change priority of running processes
Linux / Service and process management / renice.html
Changes the nice value of processes that are already running.
Basic Information
| Command Name | renice |
|---|---|
| One-line Introduction | Changes the nice value of processes that are already running. |
| Provided by | util-linux (installed by default) |
| Official Documentation | https://man7.org/linux/man-pages/man1/renice.1.html |
| Supported Operating Systems | Linux |
| Installation Status | Installed by default (no separate installation needed) |
| Category | Linux service and process management (tags: Process and resource management (tags: priority, process, adjust)) |
What is this command?
Unlike nice, renice changes processes that are already running instead of starting new ones.
Targets can be a PID, a user or a process group, so a sudden heavy job can be lowered immediately.
What problems does it solve?
- Lower a job that suddenly monopolizes the CPU.
- Restore priority after a backup finishes.
- Adjust every process of one user.
- Defer low-urgency work during an incident.
Key features
By PID
Give a value with -n and a PID to change one process.
- When to use: When only one job should be lowered
- What you get: Priority applied immediately
- Limitations: A new PID needs a new call
By user
The -u option adjusts every process of a user.
- When to use: When one user loads the machine
- What you get: All processes of that user adjusted
- Limitations: The blast radius is wide
By process group
The -g option applies to a whole process group.
- When to use: When lowering a pipeline together
- What you get: Priority of the group changed
- Limitations: The group ID must be known first
Installation and usage
Check whether it is installed
renice --version
apt install util-linux # usually already present
Real-world examples
Lower one PID
Raise the nice value of PID 1234 to 15.
# Lower the priority of PID 1234
renice -n 15 -p 1234
Adjust a user
Lower every process of user deploy.
# Lower all processes owned by deploy
renice -n 10 -u deploy
Raise priority
Lower the value to raise priority.
# Raise the priority (needs privilege)
renice -n -5 -p 1234