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

SSH and file transfers – ZMODEM

In the course of my work for Bluetreehost I connect to dozens…

How to Stop an Apache DDoS Attack with mod_evasive

The first inkling that I had a problem with a DDoS (Distributed Denial of Service) attack was a note sent to my inbox: lfd on server1.myhostname.com: High 5 minute load average alert – 89.14 My initial thought was that a site on my server was getting Slashdotted or encountering the Digg or Reddit effect. I run Chartbeat on several sites where this occasionally happens and I will usually get an alert from them first. A quick look at the Extended status page from Apache showed that I had a much different kind of problem.

Installing LogMeIn Hamachi on the Nokia N800 to join your PVPN

In case you were wondering, I just invented the phrase PVPN –…