Limit The CPU Usage of Any Process in Linux

CPULimit is an application for Linux that can limit the CPU usage of a process. It is useful if you want to restrict a particular application from taking up too much CPU resources and thereby crashing the system. This can also be useful when you need to run several intensive programs simultaneously.

This application runs on any distribution, but I’ll discuss its installation on Ubuntu:

sudo apt-get install cpulimit

Once installed, type this to restrict any already-running application’s CPU utilization:

sudo cpulimit -p PID -l CPU%

Where PID = the process ID and CPU% is the maximum percentage of the CPU allowed for use. For example:

sudo cpulimit -p 8992 -l 35

This will restrict process ID 8992 to no more than 35% of CPU’s availability.

(To see a list of your running processes you can just run the command TOP which will list your processes in order of CPU utilization).