How To Limit CPU Usage Of A Process In Linux With cpulimit Tool

December 30, 2013 | By
| Reply More

While administering your linux system you need to limit the CPU usage of a process, but what is the right tool to do it? Have you ever used cpulimit?

cpulimit is a nice command-line tool written in C programming language for limiting the CPU usage of a process by acting on the executable program file, absolute path name of the file or the PID of the file.

The following screenshot is a nice way to inform the reader about the cpulimit tool.

how to limit the cpu usage of a process in linux with the cpulimit tool

Install The cpulimit Tool In Linux

Install cpulimit in Ubuntu with the following command.

sudo apt-get install cpulimit

How about installing it in Fedora?

sudo yum install cpulimit

How To Use the cpulimit Tool

If you want to limit the cpu usage by acting on the executeable program file you need to use the -e option. The -l option in the following command is used to designate the percentage of CPU allowed from 0 to 100.

cpulimit -e test.exe -l 50

Do you like to limit the cpu usage of a program or a script running in your linux machine by acting on the specific process id? Before doing that you need to find the PID of the process that is using all your CPU time with the following command.


how to limit the cpu usage of a process in linux with the cpulimit tool

Then use the following command.

cpulimit -p PID -l 50

You can also limit the cpu usage of a program by using the cpulimit tool to act on the absolute pathname of the program with the following command.

cpulimit -P /usr/bin/test -l 50


Free Linux Ebook to Download

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.