Decrease energy usage with cpufrequtils


2012-10-04

One of the benefits of using Linux is how easy it is to decrease your computer's power consumption. There are a few ways to do this, but one of my favorites is to use cpufrequtils and the cpufreq-set command. With this utility, you can choose which frequency your CPU runs at. Further, you can choose the frequency for each core of your CPU, as most modern processors have multiple cores.

cpufreq-set comes with some default governors, or settings that choose the frequency for you. Although you can specify exactly what frequency your processor runs at (e.g. 1407 MHz), I prefer to let a governor choose for me. If you're looking to save energy and lower your power consumption, you will want to check out the powersave governor. First, make sure you have cpufrequtils installed (sudo apt-get install cpufrequtils for Debian and Debian derivatives, like Ubuntu and Mint). Then, enter the following command in a terminal to make use of that governor:

sudo cpufreq-set -c 0 -g powersave

This will tell your computer to use the powersave governor on the first core (0) of your processor. If you have multiple cores, you will want to do this for each core:

sudo cpufreq-set -c 1 -g powersave
sudo cpufreq-set -c 2 -g powersave

The -c flag specifies the core to change. Using cpufreq-set from cpufrequtils can make your computer more energy efficient while running linux and even give your Linux laptop longer battery life.

A note to remember: using the powersave governor can make your computer slower at doing certain tasks, so if you need to do some CPU-intensive tasks then you might want to switch to the ondemand governor for those:

sudo cpufreq-set -c 0 -g ondemand

for each core.

I also assigned an alias for each of these commands in my bash config:

alias powersave='sudo cpufreq-set -c 0 -g powersave && sudo cpufreq-set -c 1 -g powersave'

Then a simple powersave command is available.