NICE(1)                    POSIX Programmer's Manual                   NICE(1)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.

NNAAMMEE
       nice -- invoke a utility with an altered nice value

SSYYNNOOPPSSIISS
       nice [[-n _i_n_c_r_e_m_e_n_t]] _u_t_i_l_i_t_y [[_a_r_g_u_m_e_n_t...]]

DDEESSCCRRIIPPTTIIOONN
       The _n_i_c_e utility shall invoke a utility, requesting that it be run with
       a different nice value (see the Base Definitions volume of
       POSIX.1-2017, _S_e_c_t_i_o_n _3_._2_4_4, _N_i_c_e _V_a_l_u_e).  With no options, the
       executed utility shall be run with a nice value that is some
       implementation-defined quantity greater than or equal to the nice value
       of the current process. If the user lacks appropriate privileges to
       affect the nice value in the requested manner, the _n_i_c_e utility shall
       not affect the nice value; in this case, a warning message may be
       written to standard error, but this shall not prevent the invocation of
       _u_t_i_l_i_t_y or affect the exit status.

OOPPTTIIOONNSS
       The _n_i_c_e utility shall conform to the Base Definitions volume of
       POSIX.1-2017, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x _G_u_i_d_e_l_i_n_e_s.

       The following option is supported:

       --nn _i_n_c_r_e_m_e_n_t
                 A positive or negative decimal integer which shall have the
                 same effect on the execution of the utility as if the utility
                 had called the _n_i_c_e() function with the numeric value of the
                 _i_n_c_r_e_m_e_n_t option-argument.

OOPPEERRAANNDDSS
       The following operands shall be supported:

       _u_t_i_l_i_t_y   The name of a utility that is to be invoked. If the _u_t_i_l_i_t_y
                 operand names any of the special built-in utilities in
                 _S_e_c_t_i_o_n _2_._1_4, _S_p_e_c_i_a_l _B_u_i_l_t_-_I_n _U_t_i_l_i_t_i_e_s, the results are
                 undefined.

       _a_r_g_u_m_e_n_t  Any string to be supplied as an argument when invoking the
                 utility named by the _u_t_i_l_i_t_y operand.

SSTTDDIINN
       Not used.

IINNPPUUTT FFIILLEESS
       None.

EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
       The following environment variables shall affect the execution of _n_i_c_e:

       _L_A_N_G      Provide a default value for the internationalization
                 variables that are unset or null. (See the Base Definitions
                 volume of POSIX.1-2017, _S_e_c_t_i_o_n _8_._2, _I_n_t_e_r_n_a_t_i_o_n_a_l_i_z_a_t_i_o_n
                 _V_a_r_i_a_b_l_e_s for the precedence of internationalization
                 variables used to determine the values of locale categories.)

       _L_C___A_L_L    If set to a non-empty string value, override the values of
                 all the other internationalization variables.

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

       _L_C___M_E_S_S_A_G_E_S
                 Determine the locale that should be used to affect the format
                 and contents of diagnostic messages written to standard
                 error.

       _N_L_S_P_A_T_H   Determine the location of message catalogs for the processing
                 of _L_C___M_E_S_S_A_G_E_S.

       _P_A_T_H      Determine the search path used to locate the utility to be
                 invoked.  See the Base Definitions volume of POSIX.1-2017,
                 _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t _V_a_r_i_a_b_l_e_s.

AASSYYNNCCHHRROONNOOUUSS EEVVEENNTTSS
       Default.

SSTTDDOOUUTT
       Not used.

SSTTDDEERRRR
       The standard error shall be used only for diagnostic messages.

OOUUTTPPUUTT FFIILLEESS
       None.

EEXXTTEENNDDEEDD DDEESSCCRRIIPPTTIIOONN
       None.

EEXXIITT SSTTAATTUUSS
       If _u_t_i_l_i_t_y is invoked, the exit status of _n_i_c_e shall be the exit status
       of _u_t_i_l_i_t_y; otherwise, the _n_i_c_e utility shall exit with one of the
       following values:

       1-125   An error occurred in the _n_i_c_e utility.

         126   The utility specified by _u_t_i_l_i_t_y was found but could not be
               invoked.

         127   The utility specified by _u_t_i_l_i_t_y could not be found.

CCOONNSSEEQQUUEENNCCEESS OOFF EERRRROORRSS
       Default.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       The only guaranteed portable uses of this utility are:

       _n_i_c_e _u_t_i_l_i_t_y
             Run _u_t_i_l_i_t_y with the default higher or equal nice value.

       _n_i_c_e --nn <_p_o_s_i_t_i_v_e _i_n_t_e_g_e_r> _u_t_i_l_i_t_y
             Run _u_t_i_l_i_t_y with a higher nice value.

       On some implementations they have no discernible effect on the invoked
       utility and on some others they are exactly equivalent.

       Historical systems have frequently supported the <_p_o_s_i_t_i_v_e _i_n_t_e_g_e_r> up
       to 20. Since there is no error penalty associated with guessing a
       number that is too high, users without access to the system conformance
       document (to see what limits are actually in place) could use the
       historical 1 to 20 range or attempt to use very large numbers if the
       job should be truly low priority.

       The nice value of a process can be displayed using the command:


           ps -o nice

       The _c_o_m_m_a_n_d, _e_n_v, _n_i_c_e, _n_o_h_u_p, _t_i_m_e, and _x_a_r_g_s utilities have been
       specified to use exit code 127 if an error occurs so that applications
       can distinguish ``failure to find a utility'' from ``invoked utility
       exited with an error indication''. The value 127 was chosen because it
       is not commonly used for other meanings; most utilities use small
       values for ``normal error conditions'' and the values above 128 can be
       confused with termination due to receipt of a signal. The value 126 was
       chosen in a similar manner to indicate that the utility could be found,
       but not invoked. Some scripts produce meaningful error messages
       differentiating the 126 and 127 cases. The distinction between exit
       codes 126 and 127 is based on KornShell practice that uses 127 when all
       attempts to _e_x_e_c the utility fail with [[EENNOOEENNTT]], and uses 126 when any
       attempt to _e_x_e_c the utility fails for any other reason.

EEXXAAMMPPLLEESS
       None.

RRAATTIIOONNAALLEE
       The 4.3 BSD version of _n_i_c_e does not check whether _i_n_c_r_e_m_e_n_t is a valid
       decimal integer. The command _n_i_c_e --xx _u_t_i_l_i_t_y, for example, would be
       treated the same as the command _n_i_c_e ----11 _u_t_i_l_i_t_y.  If the user does not
       have appropriate privileges, this results in a ``permission denied''
       error.  This is considered a bug.

       When a user without appropriate privileges gives a negative _i_n_c_r_e_m_e_n_t,
       System V treats it like the command _n_i_c_e --00 _u_t_i_l_i_t_y, while 4.3 BSD
       writes a ``permission denied'' message and does not run the utility.
       The standard specifies the System V behavior together with an optional
       BSD-style ``permission denied'' message.

       The C shell has a built-in version of _n_i_c_e that has a different
       interface from the one described in this volume of POSIX.1-2017.

       The term ``utility'' is used, rather than ``command'', to highlight the
       fact that shell compound commands, pipelines, and so on, cannot be
       used. Special built-ins also cannot be used.  However, ``utility''
       includes user application programs and shell scripts, not just
       utilities defined in this volume of POSIX.1-2017.

       Historical implementations of _n_i_c_e provide a nice value range of 40 or
       41 discrete steps, with the default nice value being the midpoint of
       that range. By default, they raise the nice value of the executed
       utility by 10.

       Some historical documentation states that the _i_n_c_r_e_m_e_n_t value must be
       within a fixed range. This is misleading; the valid _i_n_c_r_e_m_e_n_t values on
       any invocation are determined by the current process nice value, which
       is not always the default.

       The definition of nice value is not intended to suggest that all
       processes in a system have priorities that are comparable. Scheduling
       policy extensions such as the realtime priorities in the System
       Interfaces volume of POSIX.1-2017 make the notion of a single
       underlying priority for all scheduling policies problematic. Some
       implementations may implement the _n_i_c_e-related features to affect all
       processes on the system, others to affect just the general time-sharing
       activities implied by this volume of POSIX.1-2017, and others may have
       no effect at all. Because of the use of ``implementation-defined'' in
       _n_i_c_e and _r_e_n_i_c_e, a wide range of implementation strategies are
       possible.

       Earlier versions of this standard allowed a --_i_n_c_r_e_m_e_n_t option. This
       form is no longer specified by POSIX.1-2008 but may be present in some
       implementations.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _C_h_a_p_t_e_r _2, _S_h_e_l_l _C_o_m_m_a_n_d _L_a_n_g_u_a_g_e, _r_e_n_i_c_e

       The Base Definitions volume of POSIX.1-2017, _S_e_c_t_i_o_n _3_._2_4_4, _N_i_c_e _V_a_l_u_e,
       _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t _V_a_r_i_a_b_l_e_s, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x
       _G_u_i_d_e_l_i_n_e_s

       The System Interfaces volume of POSIX.1-2017, _n_i_c_e()

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1-2017, Standard for Information Technology --
       Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the
       Institute of Electrical and Electronics Engineers, Inc and The Open
       Group.  In the event of any discrepancy between this version and the
       original IEEE and The Open Group Standard, the original IEEE and The
       Open Group Standard is the referee document. The original Standard can
       be obtained online at http://www.opengroup.org/unix/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2017                              NICE(1)
