nice
Processes and system
Usage
nice -n <19..-20> <command>Starts a command with a lower CPU priority; the value runs from 19 (most yielding) to -20 (greediest), negative values need root, and it affects only CPU, not disk (that is ionice).
Common flags
| Flag | Meaning |
|---|---|
| -n 19 | Lowest priority: yields the CPU to everything else. |
| -n 10 | What you get if you run nice with no -n at all. |
| -n -5 | Higher priority than normal. Negative values need root. |
Examples
nice -n 19 tar -czf backup.tar.gz /dataCompress a big directory without slowing down the rest of the machine.
sudo nice -n -5 ./latency-sensitiveGive a process more CPU priority than normal.
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 nice do?
Starts a command with a lower CPU priority; the value runs from 19 (most yielding) to -20 (greediest), negative values need root, and it affects only CPU, not disk (that is ionice).
Q. How do I type it?
nice -n <19..-20> <command> — square brackets mark the parts you can leave out.
Q. How many flags are worth knowing?
3 are listed here; the full set is in man nice. This command sits under Processes and system.
Related commands
man page: man nice