Pages

02 April 2020

cpulimit YAIT (Yet Another Impressive Tool)

One of the truly impressive tools I discovered this week is cpulimit. It allows you to limit how much cpu percentage a process can use. It is specially indicated when running cpu intensive applications. In my case it is 'ffmpeg'.                                                                                                     
                                                                                                                                       
I use 'ffmpeg' on a daily basis to convert my .avi videos to .mp4. I often run the script at night with cron.daily but the problem arises when I need to run it during the day. Here comes cpulimit to the rescue:

 $ cpulimit -e ffmpeg -l 800 -b

Here is a quick explanation:
 -e ffmpeg (the process to limit)
 -l 800 (I have 16 cores: 800 = 50%)
 -b Run cpulimit in the background to free the terminal

Really impressive (and handy).