How to Check Your Laptop’s Battery Health in Linux

Does your laptop battery come with a “Help, I’m sick” indicator? Most likely, the answer is “No”. Since that’s the case for everyone, regularly checking if your laptop needs a battery replacement is an important task.

Luckily, Linux has all kinds of utilities for checking the status and health of your device’s battery. Since most of them are terminal-based, an average user might find it hard to decode the information provided by such utilities.

Don’t worry. By the end, you will have a good understanding of laptop batteries and how to check battery health on Linux, using both graphical and command-line tools.

Battery Cycles and Design Capacity

First, you need to understand which factors play the most important role in calculating the health of a battery. Every battery has a limited amount of energy that it can store, measured in mAh, or milliamp hour. Batteries are manufactured with a specific energy limit, also known as their design capacity.

A battery cycle is a unit used by manufacturers to denote the life of a battery. When you use your laptop and the battery drains from 100% to 0%, it is counted as one battery cycle. The numbers don’t always have to be 100 and a zero, though. You can discharge your battery from 100% to 75% four times, and that would count as a single battery cycle.

Over time, as the battery gets old and the amount of battery cycles increases, the design capacity of the battery degrades. This means that if you own a battery with a design capacity of 40,000 mAh and 100 battery cycles, the current energy capacity of the battery would be somewhere around 35,000 mAh (informed guess).

Therefore, if the difference between the design capacity and current capacity is very little, you can conclude that your battery is healthy. On the contrary, a battery whose current capacity is significantly less than the design capacity needs to be replaced.

Check Your Laptop’s Battery Life Using the Terminal

On Linux, several utilities provide information associated with your laptop’s battery. You can try any of the following methods to get a rough estimate of battery health.

The upower Command

If you’re using Linux, the simplest way to get battery-related statistics is using the upower command. You can use this utility to list down all the power sources available and manage the overall power management on your system.

To display a list of all the available power sources, type:

upower -e

Output:

The second entry, i.e. battery_BAT0 is the laptop battery. To get detailed information related to this power source, use the -i flag with the command:

upower -i /org/freedesktop/UPower/devices/battery_BAT0

The system will display the following output:

Take a look at the values next to the energy-full and energy-full-design labels. For this laptop, the current energy capacity and the design capacity are the same, which means the battery is in good health. However, if in your case the difference is significant, consider replacing the battery.

Using the acpi Utility

ACPI stands for Advanced Configuration and Power Interface. You can use the acpi command in Linux to display information associated with your laptop’s battery. This command extracts the information from the /proc and /sys filesystem.

Most Linux distros don’t ship with the acpi utility preinstalled. You can install acpi on any Linux distribution using the default package manager.

On Debian and Ubuntu:

sudo apt install acpi

To install acpi on Arch-based distributions:

sudo pacman -S acpi

On RHEL-based distros like Fedora and CentOS:

sudo dnf install acpi

After installing the package, type the following command in the terminal:

acpi -V

Output:

Note down the values next to design capacity and last full capacity. If these values are the same, it means that your laptop battery hasn’t degraded.

Overheating also affects the life and health of a battery. To view the thermal statistics for your battery, use the -t flag.

acpi -t

Using the power_supply Directory

Linux stores all data in the form of files, even hardware components. You can find directories specially reserved for your laptop’s battery, system memory, and more.

Most of the command-line tools discussed above make use of these directories to extract information related to the battery. You can use the cd command to switch to those directories and read the content of the files inside.

Information associated with your system battery is stored in the /sys/class/power_supply/BAT0 directory. To start, head over to the directory using the terminal:

cd /sys/class/power_supply/BAT0

Use the ls command to list down the files and folders present inside the directory:

ls

You’ll find the files energy_full and energy_full_design inside the directory.

Output:

View the content of these two files using cat:

cat energy_full
cat energy_full_design

Output:

As you can see, the files contain two numbers that denote the current capacity and design capacity of your battery. Compare these two numbers and check if the difference is large enough. On the contrary, if the difference is not much, your laptop battery is in great shape.

Related: Simple Tips to Improve Your Linux Laptop’s Battery Life

Check Battery Health Information Graphically on Ubuntu

Not everyone feels at home while working with the command line. Ubuntu provides such users with a way to check battery-related information graphically.

Search for Power Statistics in the Applications menu and open the program. In the left sidebar, click on the Laptop battery option.

The system will present you with the following information.

Take a look and compare the values next to the Energy when full and Energy (design) labels. Power Statistics also displays your battery capacity next to Capacity, which is 100% in this case.

Simply comparing the design capacity and the current capacity can give you a rough idea of your battery health. Lowering the screen brightness and using power management features on Linux can help you in preserving your laptop battery for a longer time.

Keeping an eye on inactive applications and closing them regularly can also increase the battery life of your laptop as it decreases the overall power consumption. You can also choose to optimize your Linux machine as that would have a positive impact on the battery life.

Source: makeuseof.com

Related posts

How to Check if Your Employer Monitors Your Work Laptop

How to Live Stream Using the Twitch Mobile App

Connections #346: Today’s Answer and Clues (Wednesday, May 22, 2024)