DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

nice(C)


nice -- run a command at a different scheduling priority

Syntax

nice [ -n increment ] command [ argument ... ]

nice [ -increment ] command [ argument ... ]

Description

The nice command is used to execute a command at a different scheduling priority than usual. Each process has a nice value which is used to calculate its priority. Nice values range from 0 to 39, with higher nice values resulting in lower priorities. By default, when nice is not used, commands have a nice value of 20. nice executes command with a nice value equal to 20 plus increment. If no increment is specified, a value of 10 is assumed giving a nice value of 30.

The preferred syntax for invoking nice is to use the -n option to specify the increment. The older form (using -increment) is obsolete but still supported. Using the older form of the command, root can run commands with priority higher than normal by specifying a negative increment. For example, an argument of --10 would decrement the default nice value of 20 by 10 to produce a nice value of 10. This nice value will give a process a higher scheduling priority than the default nice value of 20. Using the new form of the syntax, the increment to the nice value would be specified as -n -10.

Only root may specify a negative value for increment.

You can use the -l and -o nice options to the ps(C) command to display the nice value of a process.

Exit values

nice returns the exit status of command. Otherwise, it exits with one of the following values:

2
a usage error of nice

126
command was found but could not be invoked

127
command could not be found

Examples

Compress large.file with a nice value of 24:

nice -n 4 compress large.file

Limitations

If the default nice value plus increment is larger than 39, a nice value of 39 will be used. If a nice value less than zero is requested, zero will be used.

Note also that this description of nice applies only to programs run under the Bourne Shell. The C-Shell has its own nice command, which is documented in csh(C).

By default, background jobs run by the Bourne and Korn shells are assigned a nice value four greater than that of the parent shell. The ksh(C) option +o bgnice disables this behavior, causing background processes to run with the same nice value as the parent shell.

See also

csh(C), ksh(C), nice(S-osr5), nohup(C), ps(C), renice(C)

Standards conformance

nice is conformant with:

ISO/IEC DIS 9945-2:1992, Information technology - Portable Operating System Interface (POSIX) - Part 2: Shell and Utilities (IEEE Std 1003.2-1992);
AT&T SVID Issue 2;
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005