renice
Processes and system
Usage
renice -n <priority> -p <pid>Changes the priority of a process that is already running; an ordinary user can only make it nicer, and taking the priority back again needs root.
Common flags
| Flag | Meaning |
|---|---|
| -n <value> | The new niceness, from 19 (nicest) to -20 (greediest). |
| -p <pid> | Apply it to a process ID. |
| -u <user> | Apply it to all of a user's processes. |
| -g <pgid> | Apply it to a process group. |
Examples
renice -n 10 -p 1234Make a running job nicer so it stops hogging the CPU.
sudo renice -n -5 -p $(pgrep -x mysqld)Give the database more priority than everything else.
What is running and what is eating the machine. Identifying it comes before killing it.
How to read this
- Square brackets [ ] mark a part you may leave out.
- An ellipsis … means you can list more than one.
- Flags are case-sensitive — in some commands -r and -R do different things.
Questions
Q. What does renice do?
Changes the priority of a process that is already running; an ordinary user can only make it nicer, and taking the priority back again needs root.
Q. How do I type it?
renice -n <priority> -p <pid> — square brackets mark the parts you can leave out.
Q. How many flags are worth knowing?
4 are listed here; the full set is in man renice. This command sits under Processes and system.
Related commands
man page: man renice