Process priority: nice and renice
Updated November 1, 2026
A process's priority is set by its nice value, from -20 (greediest) to 19 (most yielding). A normal user can only lower the priority.
nice -n 10 long-task & # start at a lower priority
ps -o pid,ni,comm -u student
renice 15 -p 1234 # change a running processSample output
$ nice -n 10 sleep 300 &
$ sleep 200 &
$ ps -o pid,ni,stat,comm
PID NI STAT COMMAND
1 0 Ss bash
7 10 SN sleep
8 0 S sleep
10 0 R ps
$ renice 15 -p 7
7 (process ID) old priority 10, new priority 15
$ renice 5 -p 7
renice: failed to set priority for 7 (process ID): Permission deniedThe higher the nice value, the more readily the process yields the CPU. Only root can raise priority (a negative nice).
Common mistakes
nice with no number does not mean "normal priority", it means an increment of 10: nice ps -o pid,ni,comm shows NI 10 for ps. The form nice -10 command gives the same +10, not minus ten - the number after the dash is read as the increment. A negative value goes in as its own argument: nice -n -10.
Only root can raise priority, and the two commands refuse in different ways. nice -n -5 sleep 1 prints nice: cannot set niceness: Permission denied, then runs sleep anyway at the normal priority and exits with code 0, so inside a script the refusal passes unnoticed. renice refuses outright: lowering your own process works (7 (process ID) old priority 10, new priority 15), but moving it back does not - renice: failed to set priority for 7 (process ID): Permission denied.
nice changes the priority of one command, not of a whole pipeline. In nice -n 19 sleep 100 | cat the sleep gets NI 19 while cat stays at NI 0: only the command right after nice is affected. To make the whole pipeline yield, wrap it: nice -n 19 bash -c 'command1 | command2'.
Used in
You need this in the lesson Processes and jobs.