Interview Q&A / Linux & Shell

IntermediateQuick answer1 min readUpdated 3 Oct 2026

What are nice and renice, and what do the values mean?

SHORT ANSWER

nice starts a process with a chosen priority adjustment and renice changes it for a running process. Niceness ranges from -20 (highest priority) to 19 (lowest). Lowering priority with a higher number is polite to others; raising it needs root.

Explain it simply

Think of a queue at a railway ticket counter. A "nice" person lets others go first. The higher the niceness value, the nicer the process, and the less CPU time it grabs when the machine is busy.

Range: -20 (greediest, highest priority) to 19 (nicest, lowest priority). The default is 0. Ordinary users can only make their own processes nicer (raise the number); lowering below 0 requires root.

nice -n 10 ./backup.sh starts a job with niceness 10. renice -n 15 -p 2345 changes a job that is already running. You can view it in the NI column of top or with ps -o pid,ni,cmd.

Niceness only matters when CPUs are contended. On an idle machine, a nice-19 job still runs at full speed. It does not limit disk I/O; ionice does that.

Example

bash
nice -n 10 tar czf backup.tgz /data &
ps -o pid,ni,cmd -C tar
#   PID  NI CMD
#  3310  10 tar czf backup.tgz /data
sudo renice -n -5 -p 3310       # raising priority needs root

What to say in the interview

"Niceness runs from -20 to 19; a higher number means lower priority. nice starts a process with a value, renice changes a running one. Users can only lower priority of their processes, root can raise it. It only matters when the CPU is busy."

Common mistakes

  • Believing a higher nice number means higher priority; it is the opposite.

#linux#processes#nice

Related questions

Practise more Linux & Shell questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Linux & Shell quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.