Save Battery in your Linux Operating System’s Laptops ?

DevProgramming
5 min readMay 28, 2022

Save your Linux Installed Laptop’s Battery with the help of these tools.

Ubuntu is a well-known and extensively used Linux distribution. Its appeal stems from its dependability and simplicity of usage. The majority of users use Ubuntu for a variety of purposes, but mostly for programming and development. People who have Ubuntu installed on their laptops encounter a slew of troubles, whereas PC users may have fewer problems. On a laptop, Ubuntu performance and battery life are a concern. Ubuntu still lags while performing Deep Learning tasks, even with NVIDIA Graphics and 32 GB of RAM. It makes no difference whether you use a MacBook or a regular gaming laptop because the battery life will be the same. Linux, however, does not always work with you. Despite the fact that several distributions have improved their battery efficiency, they do not make the greatest use of them. Despite the fact that many distributions have improved their power economy, they don’t make the most use of what your CPU can accomplish to provide you with the most productive experience.

A good working order Windows laptop will last 8–9 hours on a charge, whereas a MacBook will last over 11 hours, and an Ubuntu laptop would last roughly 4 hours. Linux is power efficient when it is fine-tuned to the hardware it is running on. There are several strategies that can help you conserve battery power on Ubuntu, but you’ll need to do more than the techniques to save battery on Ubuntu. Installing the lightweight Ubuntu distros like KUBUNTU and LUBUNTU is thought to assist with the battery issue, and it does, but only a bit. GNOME is most likely to blame for Ubuntu’s battery consumption.

There are two programmes that can help you preserve battery life. Installing and using these programmes on Ubuntu will enhance your battery backup. The main issue with a Linux-installed laptop is that the CPU works inefficiently and un-optimized, which has a detrimental impact on battery life. This problem may be solved by using the programme auto-cpufreq, which is a tool that optimises your CPU and battery power in both permanent and temporary states, keeping your Linux system in excellent working order and extending the battery life of your laptop without sacrificing anything.

LET’s INSTALL IT

There are two ways to install it. The first way is from snap and the second way is from the source. I prefer installing it from the source.

Visit its official GitHub repository and clone the git repository by typing the command.

git clone https://github.com/AdnanHodzic/auto-cpufreq

After cloning the git repository, Navigate into the cloned directory and build it from the source by typing the command.

cd auto-cpufreq && sudo ./auto-cpufreq-installer

After running that, it’ll show the option to choose, as shown in the picture below:

Type I to proceed. This step will install all the necessary packages. After a successful installation, you will get a message as shown in the picture below.

Now, you’ve successfully installed auto-cpufreq on your Linux system and the next step would be how to run it.

sudo auto-cpufreq

The above command will start the auto-cpurfrreq and it has 3 modes.

1. MONITOR MODE

This mode made no changes to the system because this mode is like a demonstration purpose, like what auto-cpufreq could do differently for your system. If you want to enable this mode, then type the command:

sudo auto-cpufreq --monitor

2. LIVE MODE

This mode will make some changes which are temporary to the system and it will be lost when you reboot the system. This mode just shows you how a system would run if the changes were to be permanently implemented. If you want to enable this mode, then type the command:

sudo auto-cpufreq --live

3. DAEMON MODE

This mode will make changes to the system and auto-cpufreq is deployed as a daemon. Daemon is deployed and then started as a systemd service. Changes are made automatically and live stats are generated for monitoring purposes. If you want to enable this mode, then type the command:

sudo auto-cpufreq --install

The above command will install auto-cpufreq as a daemon and then auto-cpufreq is available as binary and is running in the background. You can verify the status of the daemon by typing the command:

sudo systemctl status auto-cpufreq

You can also check the stats by typing the command:

auto-cpufreq --stats

REMOVING THE auto-cpufreq DAEMON

If you want to remove the auto-cpufreq daemon and its systemd service, along with all its persistent changes, then type the command:

sudo auto-cpufreq --remove

INSTALLING TLP

Installing TLP with the auto-cpufreq would be a good option. TLP is a tool that can apply various tweaks to improve the battery on your Linux based Laptops. It comes with a pre-defined and well-commented config file that you can customize to configure power optimization settings according to your needs. It also comes with some sensible defaults that are used to automatically optimize power consumption on your Linux system.

Installing TLP is very easy on Linux Distributions, type the command :

sudo apt install tlp

After installation, start the TLP by typing the command:

sudo tlp start

You can also check the status of the TLP utility by typing the command:

sudo tlp-stat -s

REMOVING TLP

If you want to remove TLP from your system, then simply type the command:

sudo apt purge tlp --auto-remove

You might be heard of these two tools already but installing these tools on Linux installed laptops will improve your Linux laptop’s battery backup. You can set up auto-cpufreq as you want and check the stats.

Thanks for reading this article.

--

--

DevProgramming

Tech Enthusiast | Developer | Sharing insights on Programming, Linux, Tech, and Cybersecurity. Committed to shaping the future through innovation.