Install cpulimit
Type the following commands to install latest stable release:# cd /tmp
# wget 'http://downloads.sourceforge.net/cpulimit/cpulimit-1.1.tar.gz'
# tar -zxvf cpulimit-1.1.tar.gz
# cd cpulimit-1.1
# make
# cp cpulimit /usr/local/sbin/
# rm -rf cpulimit*
A note about Debian / Ubuntu Linux users
Type the following command to install cpulimit:$ sudo apt-get update
$ sudo apt-get install cpulimit
How do I use cpulimit?
To limit CPU usage of the process called firefox to 30%, enter:# cpulimit -e firefox -l 30
To limit CPU usage of the process to 30% by using its PID, enter:# cpulimit -p 1313 -l 30
To find out PID of the process use any of the following:# ps aux | less
# ps aux | grep firefox
# pgrep -u vivek php-cgi
# pgrep lighttpd
You can also use absolute path name of the executable, enter:# cpulimit -P /opt/firefox/firebox -l 30
Where,
- -p : Process PID.
- -e : Process name.
- -l : percentage of CPU allowed from 0 to 100.
- -P: absolute path name of the executable program file.
No comments:
Post a Comment