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.
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:
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! end
This 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 *.c
This 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 5L Version 5.2 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 5L Version 5.2 System User's Guide: Operating System and Devices discusses what processes are and input and output redirection.
Shells Overview in AIX 5L Version 5.2 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 5L Version 5.2 Performance Management Guide.