What Does NI Mean in htop?

The NI column in the htop Linux command-line utility stands for Nice value, which represents a process’s scheduling priority. This article provides a quick overview of what this metric means, how it influences CPU resource allocation, and how system administrators can modify it to optimize system performance.

Understanding the Nice Value (NI)

In Linux operating systems, the kernel’s scheduler determines how much CPU time each running process receives. The NI column displays a user-space priority indicator ranging from -20 to 19.

Contrary to what might seem intuitive, a lower number means a higher priority. The term “nice” comes from the idea of how polite or “nice” a process is being to other processes on the system:

The Relationship Between NI and PRI

While looking at htop, you will notice the PRI (Priority) column right next to the NI column. They are directly related but represent different things:

The mathematical relationship in standard Linux environments generally follows this formula:

$$ = 20 + $$

Because the kernel’s internal priority scale usually maps from 0 (highest) to 39 (lowest), a default process with an NI of 0 will have a PRI of 20. If you lower the nice value to -20, the PRI drops to 0, granting it the highest possible scheduling priority.

How to Modify the NI Value in htop

One of the main advantages of using htop over the traditional top command is the ability to interactively change a process’s nice value on the fly, a process known as renicing.

  1. Navigate to the target process using the Up and Down arrow keys.
  2. To increase the nice value (lower the priority), press F7 or [.
  3. To decrease the nice value (raise the priority), press F8 or ]. Note that reducing the nice value below 0 requires htop to be running with root/sudo privileges.