cpulimit: command not found

The cpulimit command is a utility in Linux that is used to limit the CPU usage of a process. This can be useful if you want to ensure that a process does not consume too much CPU time, or if you want to limit the impact of a CPU-intensive process on the overall performance of the system.

Here is an example of using the cpulimit command:

# cpulimit -p PID -l LIMIT

This will limit the CPU usage of the process with the specified PID to the specified limit (expressed as a percentage of the CPU’s total capacity). For example, if you specify a limit of 50%, the process will not be allowed to consume more than 50% of the CPU’s time.

It is important to note that limiting the CPU usage of a process may affect its performance and may cause it to take longer to complete its tasks. Therefore, it is recommended to use the cpulimit command with caution and only when necessary.

If you encounter the below error while running the command cpulimit:

cpulimit: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
Debian apt-get install cpulimit
Ubuntu apt-get install cpulimit
Alpine apk add cpulimit
Arch Linux pacman -S cpulimit
Kali Linux apt-get install cpulimit
Fedora dnf install cpulimit
OS X brew install cpulimit
Raspbian apt-get install cpulimit

cpulimit Command Examples

1. Limit an existing process with PID 1234 to only use 25% of the CPU:

# cpulimit --pid 1234 --limit 25%

2. Limit an existing program by its executable name:

# cpulimit --exe program --limit 25

3. Launch a given program and limit it to only use 50% of the CPU:

# cpulimit --limit 50 -- program arg1 arg2 ...

4. Launch a program, limit its CPU usage to 50% and run cpulimit in the background:

# cpulimit --limit 50 --background -- program

5. Kill its process if the program’s CPU usage goes over 50%:

# cpulimit --limit 50 --kill -- program

6. Throttle both it and its child processes so that none go about 25% CPU:

# cpulimit --limit 25 --monitor-forks -- program
Related Post