nice
Run a program at an altered priority (POSIX)
Syntax:
nice [-nprioritylevels] command [arguments]...
Deprecated:
nice [-prioritylevels] command [arguments]...
Runs on:
QNX OS
Options:
- -prioritylevels
- Deprecated; this is the historical method of specifying the amount to adjust the current priority by. Specifying -1 lowers the priority by one, while specifying --1 boosts the priority by one.
- -n prioritylevels
- Specify the amount to adjust the current priority by when running the command. The command is run at a priority level of the current priority minus prioritylevels.
- command [arguments]...
- The command to run at the altered priority.
Description:
The nice utility invokes the specified command with a
modified priority, usually making the command behave more nicely
towards competing processes.
If no prioritylevels option is specified, the
program is invoked at a priority that's one level lower than the
parent's current priority (i.e., it's invoked with a nice increment
of 1).
If a prioritylevels option is specified, it's subtracted from the parent's current priority and the program is invoked at the resultant priority. If the resulting priority isn't a valid priority, nice writes a diagnostic message to the standard error and exits with a status of 1.
If you enter: | nice: |
---|---|
A positive value (e.g., -n2 or -n+2) | Lowers the priority of the program, making it nice |
A negative value (e.g., -n-2) | Raises the priority of the program, making it mean |
If you're: | You can change to any priority: |
---|---|
A non-root user | From 1 to 63 |
root | From 1 to 255 |
You can change the range of privileged priorities with the -P option for procnto.
Examples:
nice make application
nice -n2 make application
nice -n-2 make application
Exit status:
- 1
- Invalid command-line parameters were given or the user requested an invalid priority.
- 126
- The command specified didn't exist.
- 127
- The command couldn't be started for some other reason.
Caveats:
wholepriority level. For example, where the following has a marginal effect on the execution of myprog on some operating systems:
nice -n5 myprog
on QNX OS it lowers the priority of myprog by five full priority levels, and could have a significant effect on myprog's execution time.