nice — Run a command at a different priority

Format

nice [–n number] command-line nice [number] command-line

tcsh shell: nice [+number] [command]

Description

nice runs a command at a different priority than usual. Normally, nice lowers the current priority by 10.

The command-line must invoke a single utility command, without using compound commands, pipelines, command substitution, and other special structures.

In the tcsh shell, nice sets the scheduling priority for the tcsh shell to number, or, without number, to 4. With command, nice runs command at the appropriate priority. The greater the number, the less cpu the process gets. The super-user may specify negative priority by using:
nice -number
command is always executed in a subshell, and the restrictions placed on commands in simple if statements apply. See tcsh — Invoke a C shell.

Options

–n number
Lowers the current priority by number. On systems supporting higher priorities, a user with appropriate privileges can use nice to increase priority by specifying a negative value for number. For example,
nice –n –3 command
runs the command with an increased priority of 3.
number
Is an obsolete version of –n number.

Localization

nice uses the following localization environment variables:
  • LANG
  • LC_ALL
  • LC_CTYPE
  • LC_MESSAGES
  • NLSPATH

See Localization for more information.

Exit values

If nice invokes the command-line, it exits with the exit status returned by command-line; otherwise its exit status is one of the following:
1-125
An error occurred in the nice utility.
126
nice could not invoke command-line.
127
nice could not find the utility specified in command-line.

Portability

POSIX.2 User Portability Extension, X/Open Portability Guide, UNIX systems.

Related information

nohup, renice, tcsh