System Administration Guide: Advanced Administration

How to Change the Priority of a Process (nice)


Note –

This section describes the syntax of the /usr/bin/nice command and not the C-shell nice built-in command. For information about the C-shell nice command, see csh(1).


  1. Determine whether you want to lower the priority of a command as a user or raise or lower the priority of a command as superuser and select one of the following:

    • Follow the examples in step 1 to lower the priority of a command as a user.

    • Follow the examples in step 2 to raise or lower priorities of a command as superuser.

  2. As a user, lower the priority of a command by increasing the nice number.

    The following nice command executes command-name with a lower priority by raising the nice number by 5 units.


    $ /usr/bin/nice -5 command-name
    
    In the preceding command, the minus sign designates that what follows is an option. This command could also be specified as follows:


    % /usr/bin/nice -n 5 command-name
    

    The following nice command lowers the priority of command-name by raising the nice number by the default increment of 10 units, but not beyond the maximum value of 40.


    % /usr/bin/nice command-name
    
  3. As superuser, raise or lower the priority of a command by changing the nice number.

    The following nice command raises the priority of command-name by lowering the nice number by 10 units, but not below the minimum value of 0.


    # /usr/bin/nice --10 command-name     
    

    In the preceding command, the first minus sign designates that what follows is an option. The second minus sign indicates a negative number.

    The following nice command lowers the priority of command-name by raising the nice number by 5 units, but not beyond the maximum value of 40.


    # /usr/bin/nice -5 command-name     
    

For more information, see nice(1).