nice

run a program at an altered priority (POSIX)

Syntax:


nice [-nincrement] command [arguments]...

Deprecated:

nice [-increment] command [arguments]...

Options:

-increment
Deprecated. This is the historical method of specifying the increment. Specifying -1 ("one") would lower the priority by one, while specifying --1 ("one") would boost the priority by one.
-n increment
A relative nice increment. The command will be run at a priority level of current_priority minus increment. The lowest priority allowed is priority 1. The highest for non-root users is 19; 29 for root. (Boost priority by specifying a negative number.)
command [arguments]...
The command to run at the altered priority.

Examples:

Run make at one priority lower than the parent's priority (be nice):

    nice make application

Run make at two priorities lower than the parent's priority (be nice):

    nice -n2 make application

Run make at two priorities higher than the parent's priority (be mean):

    nice -n-2 make application

Description:

The nice utility invokes the specified command with a modified priority, usually making the command behave "nicer" towards competing processes.

If no increment is given, the program is invoked at a priority that is one level lower than the parent's current priority (i.e. it is invoked with a nice increment of 1).

If an increment is specified, it is subtracted from the parent's current priority and the program is invoked at the resultant priority. If the resulting priority is not a valid priority, nice will write a diagnostic message to the standard error and will exit with an exit status of 1.

If you enter:nice will:
a positive increment value (e.g. -n2 or -n+2) lower the priority of the program, making it "nice"
a negative increment value (e.g. -n-2) raise the priority of the program, making it "mean"

Users may adjust the priority as follows:

If you're:You can change to any priority:
a normal user from 1 to 19
rootfrom 1 to 29

Exit status:

If the operation is successful, the exit status of the invoked command is returned. If an error occurs, the exit status is as follows:

1
Invalid command-line parameters were given or the user requested an invalid priority.
126
The command specified did not exist.
127
The command could not be started for some other reason.

See also:

Caveats:

In contrast to other operating systems, the QNX interpretation of the nice increment substantially affects the priority of the process. Rather than representing a fraction of a priority, the granularity of the nice value in QNX is of a "whole" priority. For example, where the following would have a marginal effect on the execution of myprog on some operating systems:

    nice -n5 myprog

on QNX it would lower the priority of myprog by five, and could have a significant effect on myprog's execution time.