If you wish to run a command which typically uses a lot of CPU (for example, running tar on a large file), then you probably don’t want to bog down your whole system with it. Linux systems provide the nice command to control your process priority at runtime, or renice to change the priority of an already running process. The full manpage has help, but the command if very easy to use:

$ nice -n prioritylevel /command/to/run

The priority level runs from -20 (top priority) to 19 (lowest). For example, to run tar and gzip at a the lowest priority level:

$ nice -n 19 tar -czvf file.tar.gz bigfiletocompress

similarly, if you have a process running, use ps to find the process ID, and then use renice to change it’s priority level:

$ renice -n 19 -p 987 32

This would change processes 987 and 32 to priority level 19.

1 comment
  1. Pingback: Dave Drager

Comments are closed.

You May Also Like

Send your cell phone SMS system alert messages.

SMSSend is a program used to send SMS messages over the network…

Set Operations Using Bash Commands

Found a great post over at good coders code, great reuse. This…

Dead linux users?

Not dead as in dead, but dead as in the user has logged out of the system and for some reason their shell is still open. This might happen if your system crashes before you can log out, there are network problems and you are disconnected, or a number of other reasons. This article explains how to log these “dead” shell users out.

HOWTO: Installing ZFS and setting up a Raid-Z array on Ubuntu

Readers should note that this applies to Ubuntu 8.10 Intrepid Ibex only!…