Bootstrap FreeKB - Linux Commands - nice (influence a process to run with higher or lower priority)
Linux Commands - nice (influence a process to run with higher or lower priority)

Updated:   |  Linux Commands articles

The nice command can be used to influence a process that is not currently running to run with lower or higher priority. In this example, nice is used to influence gedit to run with higher priority.

[user1@server1 ]# nice gedit

 

The nice command without any options will increase the nice value by 10, thus influencing the process to run with lower priority. In this example, the NI (nice) value of gedit is 90, which is 10 points more than the standard value of 80.

0 represents the highest priority, and 127 represents the lowest priority. 

[user1@server1 ]# ps -l
F S UID  PID  PPID   C  PRI NI ADDR SZ    WCHAN TTY     TIME       CMD
4 S 0    7521 7516   0  80  0  -    28844 wait  pts/0   00:00:00   bash
0 S 0    9588 7521  22  80  0  -    28844 -     pts/0   00:00:00   ps
0 S 0    9844 7521   0  90  10 -    28844 -     poll_s  00:00:00   gedit

 


Specify amount of influence

The -n or --adjustment option can be used to specify a value. In this example, 5 is specified, which increases the nice value of gedit from 80 to 85.

[user1@server1 ]# nice -n 5 gedit

 

The + or - characters can also be used. In this example, +19 is specified, which increases the nice value of gedit from 80 to 99. Nice does not allow you to influence beyond +19.

[user1@server1 ]# nice -n +19 gedit

 

In this example, -20 is specified, which decreases the nice value of gedit from 80 to 60. Nice does not allow you to influence beyond -20.

[user1@server1 ]# nice -n -20 gedit

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 4afddf in the box below so that we can be sure you are a human.