renice: alter priority of running processes
renice [--priority|--relative] priority [-g|-p|-u] identifier...
What it does
renice changes the nice value of running processes: -20 (most favoured) to 19 (least). A normal user may only make their own processes nicer (higher); lowering the value needs root. It changes a process's CPU share only while CPUs are contended.
Options you will use
-n, --priority priority- the new nice value (with --relative: an increment).
--relative- add the value to the current one.
-p, --pid- the identifiers are process IDs (the default).
-g, --pgrp- process group IDs.
-u, --user- user names or IDs: every process of the user.
Examples
$ renice -n 10 -p 4242make a batch job nicer
$ sudo renice -n -5 -p 1210favour a process (root only)
Gotchas
- Output: "1210 (process ID) old priority 0, new priority 10".
- Threads have their own nice value; renice -p PID changes only the thread whose ID is PID (the main thread).
Taught in
Try renice in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.