HOWTO: Change Process Priority Using the Nice Command
Amongst other things, the Linux kernel is responsible for making all running processes interact well with each other. One of the ways in which it does this is by determining which applications should get more CPU time than others. By default, the kernel handles this without interaction from the user, but there may be cases where you want to increase or decrease a process or application’s priority.
If you know before you launch the program or process that you want to manipulate its priority, you can launch it with the nice command.
Nice can be used with an integer from 0-19 if you are a normal user, and -20 to 19 if you are the superuser. Strangely, positive numbers decrease the application’s priority and negative numbers increase it. Hence why only the superuser (root) can elevate a processes’ priority via negative nice numbers.
The basic syntax of the nice command is:
nice process/application [nice number] [options]
nice foo –15 &
This command will start application foo at an elevated priority of -15 and push it to the background (&). If you don’t specify a nice number, the default of 10 is used.
What if you want to change an already running processes’ nice number? You would have to use the command renice which I will cover tomorrow.
















