HTOP nice level mismatch with the nice command

htopnice

I executed some commands with nice -20 but in htop the NI appears in red and as 19, why is this?

screenshot

Best Answer

The “nice” value ranges from -20 (top priority, not nice at all to other processes) to 19 (least priority, very nice to others). When you run nice -20 (equivalent to nice -n 20) or sudo nice -n -42 (equivalent to sudo nice --42) or any other value out of bounds, the nice value is moved to the bound.

The red is simply coloring applied to negative values in that column, indicating high-priority (“not nice”) processes. Positive values are green, indicating low-priority (“nice”) processes.

Related Question