Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

Commands:  csh(1)

nohup(1)

renice(8)

Functions:  nice(3)

setpriority(2)

Standards:  standards(5)

nice(1)  —  Commands

NAME

nice − Runs a command at a different priority

SYNOPSIS

Current syntax

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

Obsolescent syntax

nice [-priority] command [argument ...]

Note

The C shell has a built-in version of the nice command.  If you are using the C shell, and want to guarantee that you are using the command described here, you must specify the full path /usr/bin/nice.  See the csh(1) reference page for a description of the built-in command. 

STANDARDS

Interfaces documented on this reference page conform to industry standards as follows:

nice:  XPG4, XPG4−UNIX

Refer to the standards(5) reference page for more information about industry standards and associated tags. 

FLAGS

-n priority
Specifies how the system scheduling priority of the executed utility is adjusted.  The priority argument is a positive or negative decimal integer. 

Positive priority values cause a lower or unchanged system scheduling priority. 

Negative priority values might require appropriate privileges and cause a higher or unchanged system scheduling priority. 

-prioritySpecifies how the system scheduling priority of the executed utility is adjusted.  (Obsolescent)

PARAMETERS

commandThe name of a utility that is to be invoked. 

argumentAny string to be supplied as an argument to the utility named by the command operand. 

DESCRIPTION

The nice command lets you run the specified command at a lower priority.  The value of priority can range from 1 to 19, with 19 being the lowest priority.  The default value of priority is 10. 

[Digital]  If you have superuser authority, you can run commands at a higher priority by specifying priority as a negative number; for example, −10. 

ENVIRONMENT VARIABLES

The following environment variables affect the execution of nice:

LANGProvides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization variables contain an invalid setting, the utility behaves as if none of the variables had been defined. 

LC_ALLIf set to a non-empty string value, overrides the values of all the other internationalization variables. 

LC_CTYPEDetermines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). 

LC_MESSAGESDetermines the locale for the format and contents of diagnostic messages written to standard error. 

NLSPATHDetermines the location of message catalogues for the processing of LC_MESSAGES. 

PATHDetermines the search path used to locate the command invoked. 

EXAMPLES

     1.To run a low priority command in the background, enter:

nice  cc  −c  ∗.c  &

This runs the command cc −c ∗.c at low priority in the background.  Your terminal is free so that you can run other commands while cc is running.  See the sh command for details about starting background processes with an & (ampersand). 

     2.To specify a very low priority, enter:

nice −n 15  cc  −c  ∗.c  &

This runs cc in the background at a priority that is even lower than the default priority set by nice. 

     3.To specify a very high priority (ksh and sh only), enter:

nice −n −10  wall  <<end
System shutdown in 2 minutes!
end

This runs wall at a higher priority than all user processes.  Doing this slows down everything else running on the system.  If you do not have superuser authority when you run this command, then the wall command runs at the normal priority. 

The <<end and end arguments define a Here Document, which uses the text entered before the end line as standard input for the command.  For more details, see the Inline Input (Here) Documents section on the sh reference page. 

NOTES

The csh command contains a built-in subcommand named nice.  The command and subcommand do not necessarily work the same way.  For information on the subcommand, see the csh command. 

EXIT VALUES

The nice command returns the following exit values:

1-125An error occurred in the nice utility. 

126The specified command was found but could not be invoked. 

127The specified command could not be found. 

RELATED INFORMATION

Commands:  csh(1), nohup(1), renice(8)

Functions:  nice(3) setpriority(2)

Standards:  standards(5)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026