Linux nice command

Updated: 04/26/2017 by Computer Hope

About nice

Runs a command with a modified scheduling priority.


nice runs command COMMAND with an adjusted "niceness", which affects process scheduling. A process with a lower niceness value is given higher priority and more CPU time. A process with a higher niceness value (a "nicer" process) is given a lower priority and less CPU time, freeing up resources for processes that are more demanding.

Niceness values range from -20 (most favorable to the process) to 19 (least favorable to the process).

With no COMMAND, nice prints the current niceness level.

nice syntax

nice [OPTION] [COMMAND [ARG]...]


-nN, --adjustment=N Add integer N to the niceness (default is 10).
--help Display a help message and exit.
--version Output version information and exit.

nice examples


Displays the default niceness level of new processes; this is commonly zero, so the output would probably look like this:

nice -n13 pico myfile.txt

Runs the pico command on myfile.txt with an niceness increment of 13. Since we already saw that the default niceness level was zero, this runs pico with a niceness level of zero plus 13, which is 13. As a result, pico will be able to use CPU resources with a higher priority than any process running with a niceness level greater than 14, but will have a lower priority than processes with a value less than 14.

Effectively, this tells the system to treat pico as a low-priority process, but not the lowest.

csh — The C shell command interpreter.
ksh — The Korn shell command interpreter.
nohup — Instruct a command to continue running even if the session is disconnected or the user logs out.
priocntl — Display or set scheduling parameters of a processes under Solaris.
sh — The Bourne shell command interpreter.