Nice
Nice is a command to change the niceness of a process. The niceness influences the priority when processes are competing for execution time. The higher the niceness of a process, the "nicer" it will be to other processes, i.e. it will step aside and leave them more processing power. For example take setiathome that searches for extra-terrestrian intelligence. You do not want it to compete with your other processes for computing power, it shall only run if all other processes are sleeping. So you will assign it a high nice value.
The niceness is an integer between -20 and +19.
The amount of CPU time given to each runnable process depends on its priority relative to other processes in the system. So if you increase its niceness value, this decreases its priority and makes the process take less CPU time.
nice
is used to set the niceness value for a process when a command is first run. For example,
nice -n 19 setiathome
would run setiathome with the lowest possible priority. To change the niceness of a currently running process, use renice.
Privileges are required to run a command with negative niceness, or to lower the niceness of a running command.
Provided by
Most (all?) Linux distributions incorporate this from the GNU Coreutils: and use its man page
Related Commands
These all relate to running commands in an altered context.
- chroot - Confine the program to "jail".
- env - Change variables.
- nohup - Protect from hangups (modem) or network outages.
- stdbuf - Change buffering of standard I/O filestreams.
- su - Change user
- timeout - Limit the time.
- gdb - Run under control of a debugger
- script - Capture all program output
- valgrind - Validate program behavior
- strace - Create a log of system calls.
This article is a stub and needs to be finished. Plunge forward and help it grow!