Linux nice Command: Set a New Process's Scheduling Priority
nice specifies the nice value used for CPU scheduling when starting a new command. A nice value higher than the default generally indicates a tendency to yield the CPU to other tasks more easily.
What is the nice command?
The typical range of nice values in Linux is from -20 to 19, with lower values indicating higher priority. nice does not change processes that are already running. Use renice for running tasks.
Basic syntax
nice -n adjustment_value command [arguments...]
The installed implementation and options may vary depending on the distribution. Check your system's documentation with man nice.
Examples
Start with low priority
Start a read operation with a nice value 10 higher than the default.
nice -n 10 sha256sum large.log
Start with the default increment
In the GNU implementation, if the adjustment value is omitted, the default increment is used.
nice sha256sum large.log
Check the actual value
Check the NI column of the running process.
ps -p 1234 -o pid,ni,cmd
Checking the nice value of a new process
nice sets the scheduling nice value of a newly started process. The following is an example of starting a test sleep with a value of 10 and then checking it.
nice -n 10 sleep 60 & ps -o ni,comm -p $!
Example output:
NI COMMAND 10 sleep
$! is the PID of the most recent background process. Generally, the higher the number, the lower the CPU scheduling priority, but this does not mean a limit on CPU usage. To change the value of a process that is already running, use renice.
Main Options and Format
| Options/Format | Description |
|---|---|
-n value |
Specifies the adjustment value for the new command based on the existing nice value. |
--adjustment=value |
Long option format in the GNU implementation. |
run without arguments |
Displays the current nice value in the GNU implementation. |
Precautions when using
The nice value is a hint for CPU scheduling; it does not guarantee execution time or change memory or disk I/O priorities. Raising priority by lowering the nice value may not be allowed for regular users. For major load issues, first check the cause process and the type of resource.
Frequently Asked Questions
Does nice -n 10 make it 10 times faster?
No. A higher value generally means a lower CPU priority, and it does not indicate a fixed multiple of processing speed.
Official Documentation
The exact behavior of the option and implementation differences can be found in the official documentation for nice.









