Runs a command at a lower or higher priority .
nice [ - Increment| -n Increment ] Command [ Argument ... ]
The nice command lets you run a command at a priority lower than the command's normal priority. The Command parameter is the name of any executable file on the system. If you do not specify an Increment value the nice command defaults to an increment of 10. You must have root user authority to run a command at a higher priority. The priority of a process is often called its nice value.
The nice value can range from 0 to 39, with 39 being the lowest priority. For example, if a command normally runs at a priority of 20, specifying an increment of 5 runs the command at a lower priority, 25, and the command runs slower. The nice command does not return an error message if you attempt to increase a command's priority without the appropriate authority. Instead, the command's priority is not changed, and the system starts the command as it normally would.
The nice value is used by the system to calculate the current priority of a running process. Use the ps command with the -l flag to view a command's nice value. The nice value appears under the NI heading in the ps command output.
Note: The csh command contains a built-in command named nice. The /usr/bin/nice command and the csh command's nice command do not necessarily work the same way. For information on the csh command's nice command, see the csh command.
|-Increment||Increments a command's priority up or down. You can specify a positive or negative number. Positive increment values reduce priority. Negative increment values increase priority. Only users with root authority can specify a negative increment. If you specify an increment value that would cause the nice value to exceed the range of 0 to 39, the nice value is set to the value of the limit that was exceeded. This flag is equivalent to the -n Increment flag.|
|-n Increment||This flag is equivalent to the -Increment flag.|
If the command specified by the Command parameter is started, the exit status of the nice command is the exit status of the command specified by the Command parameter. Otherwise, the nice command exits with one of the following values:
|1-125||An error occurred in the nice command.|
|126||The command specified by the Command parameter was found but could not be invoked.|
|127||The command specified by the Command parameter could not be found.|
nice -n 15 cc -c *.c &This example runs the cc command in the background at a lower priority than the default priority set by the nice command.
nice --10 wall <<end System shutdown in 2 minutes! endThis example runs the wall command at a higher priority than all user processes, which slows down everything else running on the system. The <<end and end portions of the example define a here document, which uses the text entered before the end line as standard input for the command.
Note: If you do not have root user authority when you run this command, the wall command runs at the normal priority.
nice cc -c *.cThis example runs the cc command at low priority.
Note: This does not run the command in the background. The workstation is not available for doing other things.
nice cc -c *.c &This example runs the cc command at low priority in the background. The workstation is free to run other commands while the cc command is running. Refer to the "Shells Overview" in AIX Version 4.3 System User's Guide: Operating System and Devices for more information on background (asynchronous) processing.
|/usr/bin/nice||Contains the nice command.|
The csh command, nohup command, renice command.
The nice subroutine.
The Processes Overview in AIX Version 4.3 System User's Guide: Operating System and Devices discusses what processes are and input and output redirection.
Shells Overview in AIX Version 4.3 System User's Guide: Operating System and Devices describes what shells are, the different types, and how they affect the way commands are interpreted.
Controlling Contention for the CPU in AIX Versions 3.2 and 4 Performance Tuning Guide.