coreutils: nice invocation

1 
1 23.3 ‘nice’: Run a command with modified niceness
1 =================================================
1 
1 ‘nice’ prints a process’s “niceness”, or runs a command with modified
1 niceness.  “niceness” affects how favorably the process is scheduled in
1 the system.  Synopsis:
1 
1      nice [OPTION]... [COMMAND [ARG]...]
1 
1    If no arguments are given, ‘nice’ prints the current niceness.
1 Otherwise, ‘nice’ runs the given COMMAND with its niceness adjusted.  By
1 default, its niceness is incremented by 10.
1 
1    Niceness values range at least from −20 (process has high priority
1 and gets more resources, thus slowing down other processes) through 19
1 (process has lower priority and runs slowly itself, but has less impact
1 on the speed of other running processes).  Some systems may have a wider
1 range of niceness values; conversely, other systems may enforce more
1 restrictive limits.  An attempt to set the niceness outside the
1 supported range is treated as an attempt to use the minimum or maximum
1 supported value.
1 
1    A niceness should not be confused with a scheduling priority, which
1 lets applications determine the order in which threads are scheduled to
1 run.  Unlike a priority, a niceness is merely advice to the scheduler,
1 which the scheduler is free to ignore.  Also, as a point of terminology,
1 POSIX defines the behavior of ‘nice’ in terms of a “nice value”, which
1 is the non-negative difference between a niceness and the minimum
1 niceness.  Though ‘nice’ conforms to POSIX, its documentation and
1 diagnostics use the term “niceness” for compatibility with historical
1 practice.
1 
11    COMMAND must not be a special built-in utility (⇒Special
 built-in utilities).
1 
1    Due to shell aliases and built-in ‘nice’ functions, using an
1 unadorned ‘nice’ interactively or in a script may get you different
1 functionality than that described here.  Invoke it via ‘env’ (i.e., ‘env
1 nice ...’) to avoid interference from the shell.
1 
1    Note to change the “niceness” of an existing process, one needs to
1 use the ‘renice’ command.
1 
11    The program accepts the following option.  Also see ⇒Common
 options.  Options must precede operands.
1 
1 ‘-n ADJUSTMENT’
1 ‘--adjustment=ADJUSTMENT’
1      Add ADJUSTMENT instead of 10 to the command’s niceness.  If
1      ADJUSTMENT is negative and you lack appropriate privileges, ‘nice’
1      issues a warning but otherwise acts as if you specified a zero
1      adjustment.
1 
1      For compatibility ‘nice’ also supports an obsolete option syntax
1      ‘-ADJUSTMENT’.  New scripts should use ‘-n ADJUSTMENT’ instead.
1 
1    ‘nice’ is installed only on systems that have the POSIX ‘setpriority’
1 function, so portable scripts should not rely on its existence on
1 non-POSIX platforms.
1 
1    Exit status:
1 
1      0   if no COMMAND is specified and the niceness is output
1      125 if ‘nice’ itself fails
1      126 if COMMAND is found but cannot be invoked
1      127 if COMMAND cannot be found
1      the exit status of COMMAND otherwise
1 
1    It is sometimes useful to run a non-interactive program with reduced
1 niceness.
1 
1      $ nice factor 4611686018427387903
1 
1    Since ‘nice’ prints the current niceness, you can invoke it through
1 itself to demonstrate how it works.
1 
1    The default behavior is to increase the niceness by ‘10’:
1 
1      $ nice
1      0
1      $ nice nice
1      10
1      $ nice -n 10 nice
1      10
1 
1    The ADJUSTMENT is relative to the current niceness.  In the next
1 example, the first ‘nice’ invocation runs the second one with niceness
1 10, and it in turn runs the final one with a niceness that is 3 more:
1 
1      $ nice nice -n 3 nice
1      13
1 
1    Specifying a niceness larger than the supported range is the same as
1 specifying the maximum supported value:
1 
1      $ nice -n 10000000000 nice
1      19
1 
1    Only a privileged user may run a process with lower niceness:
1 
1      $ nice -n -1 nice
1      nice: cannot set niceness: Permission denied
1      0
1      $ sudo nice -n -1 nice
1      -1
1