Linux and laptop battery management have a complicated past. For years Linux has been notoriously bad at managing battery life. That’s partly because such a huge amount of the work that goes into Linux goes into the server space. It’s also because it’s hard to guess what configuration a user’s going to set up. Are you running Plasma on Gentoo and compiling software from scratch? Kiss your battery life goodbye. Do you have Ubuntu with LXQT on your laptop? You stand a good chance of that battery lasting a while.
Whatever your laptop’s setup looks like, the best thing you can do to keep it running without the nasty interruption of a dead battery is monitoring. The more you understand what’s going on with your laptop’s battery, the more control you have.
There are several great options for monitoring your laptop’s battery usage and minimizing the processes that are hogging your power. They all cover somewhat different areas, but when used together, you can get a full handle of the situation.
Default Desktop Monitors
Every desktop environment comes with its own battery monitoring applet. When you install Linux on a laptop, those applets are usually configured and displayed by default. That’s definitely the case with Ubuntu.
On more minimal desktop environments, that applet’s probably just a gauge that updates to show the battery’s current level. On more robust desktop environments, like GNOME, you should also get notification updates when the battery is discharging and when it’s nearing the end of its life.
These default monitors are your first line of defense. Keep an eye on it, and make sure that you’re not in the danger zone.
When you want more control over your battery notifications, there’s an additional program that you can install to get more detailed control over your battery level notifications. Battery Monitor isn’t yet included by any distributions, but its easy enough to install and use.
Install Battery Monitor
First, install the dependencies.
Then, download the latest sources.
Unzip it and cd into the resulting directory.
Finally, install it.
You now have access to both Battery Monitor and its settings through your desktop environment. Open the settings first.
The Settings window doesn’t have a lot on it, and it’s not very complicated. It just lets you specify the battery levels at which it will give you notifications. All the numbers are percentages. Set as many custom warning notifications as you like.
As you can see, Battery Monitor will send you notifications whenever your computer is unplugged, in addition to the warnings that you set.
It will also send notifications whenever your computer is charging and when it’s fully charged.
GNOME Power Statistics
If you’re running the GNOME desktop, you already have another nice utility to track your power usage and display it in the form of a graph. That utility is GNOME Power Statistics. If you aren’t using GNOME, you can install it easily enough.
When you open GNOME Power Statistics, you’ll see a listing of devices to the left of the window. Select your battery. Initially, you’ll see a bunch of information about the battery. Some of it’s useful, but most isn’t really what you need right now.
Click on the “History” tab. That one will show you the most about how your laptop handles its battery. First, set the length to something that makes sense. If you just installed the power manager, you’re probably only going to be able to work in 10 minute intervals until it has enough time to collect more data.
Check through the different graphs. They’ll show you things like the overall rates of charge and discharge. They’ll also give you information on the time that it takes for your battery to run down and the amount of time that it takes to charge to full.
It’s always good to know what’s hogging the most power on your system. Some processes might be killing your battery without you even knowing. They might even be things that you’re not using.
Most Linux users are familiar with Top, the utility that monitors which applications are using the most system resources. There’s a Top-like utility that monitors battery usage, called PowerTop. PowerTop might actually be installed on your system already, but you can install it easily enough anyway.
Then, just run PowerTop to see which processes are the worst offenders
Much like Top, it will list the processes by the amount of energy they’re drawing. You can take a look and see if there’s anything that you can close or kill on your system.
If watching PowerTop doesn’t seem appealing, you can always have it output to an HTML file that you can open with your browser for a more detailed compiled report.
Hopefully, with any combination of these tools, you can better understand the battery usage of your laptop. Remember that no tool is perfectly accurate, so using a combination of these is usually best. If you notice that your computer is still discharging too quickly, consider a lighter-weight desktop environment or even different settings for your GPU. Like most mobile devices, screens and graphics are a huge power draw on laptops.