Does your laptop battery have a "Help me I'm sick" message? Most likely the answer is no. Since this is the case for everyone, it is an important task to regularly check to see if your laptop needs a battery change.
Fortunately, Linux has all kinds of utilities to help you check the status and health of your device's battery. Since most of them are terminal-based, it can be difficult for the average user to decipher the information provided by such utilities.
Do not worry. By the end, you will have a good understanding of laptop batteries and how to use graphical and command line tools to check battery health on Linux.
Battery cycles and design capacity
First of all, you need to understand which factors play the most important role in calculating the health of a battery. Each battery has a limited amount of energy it can store, measured in mAh or mAh. Batteries are manufactured with a specific energy limit, also known as their design capacity.
A battery cycle is a unit of measure used by manufacturers to indicate the life of a battery. When using your laptop and the battery goes from 100% to 0% it is counted as one battery cycle. However, the numbers don't always have to be 100 and a zero. 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 ages and the number of battery cycles increases, the design capacity of the battery will decrease. This means that if you had a battery with a design capacity of 40,000 mAh and 100 battery cycles, the current energy capacity of the battery would be around 35,000 mAh (informed estimate).
So if the difference between the design capacity and the current capacity is very small, you can conclude that your battery is OK. On the contrary, a battery whose current capacity is significantly below the design capacity must be replaced.
Check the battery life of your laptop using the terminal
In Linux, various utilities provide information about your laptop's battery. You can try any of the following methods to get a rough estimate of the condition of the battery.
The upower command
If you're using Linux, the easiest way to get battery-related statistics is to use the upower command. You can use this utility to list all available power sources and manage the overall power management of your system.
Enter the following for a list of all available power sources:
The second entry, i.e. Battery_BAT0 is the laptop battery. For detailed information on this power source, use the -I Flag with the command:
upower -i / org / freedesktop / UPower / devices / battery_BAT0
The system displays the following output:
Look at the values next to that energetic and Energy-full design Labels. In this laptop, the current energy capacity and design capacity are the same, which means that the battery is in good condition. However, if the difference is significant in your case, consider replacing the battery.
Use the acpi utility
ACPI stands for Advanced Configuration and Power Interface. You can use the acpi command in Linux to view information about your laptop's battery. This command extracts the information from the / proc and / sys File system.
Most Linux distributions do not come with the acpi utility preinstalled. You can install acpi on any Linux distribution using the standard package manager.
On Debian and Ubuntu:
sudo apt install acpi
To install acpi on Arch-based distributions:
sudo pacman -S acpi
On RHEL-based distributions like Fedora and CentOS:
sudo dnf install acpi
After installing the package, enter the following command in the terminal:
Write down the values next to next Design capacity and last full capacity. If these values are the same, it means that your laptop battery has not deteriorated.
Overheating also affects the life and condition of a battery. To view the heat statistics for your battery, use the -t Flag.
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 described above use these directories to extract information about the battery. You can use the cd command to go to these directories and read the contents of the files they contain.
Information about your system battery is provided in the / sys / class / power_supply / BAT0 Directory. To begin, use the terminal to go to the directory:
cd / sys / class / power_supply / BAT0
Use the ls command to list the files and folders present in the directory:
You can find the files energetic and energy_full_design within the directory.
Use cat to display the contents of these two files:
As you can see, the files contain two numbers that indicate the current capacity and the design capacity of your battery. Compare these two numbers and see if the difference is big enough. On the contrary, if the difference isn't big, your laptop battery is in great shape.
Check battery health information graphically on Ubuntu
Not everyone feels at home working with the command line. Ubuntu offers such users the ability to graphically review battery-related information.
Search for Performance statistics by doing Applications Menu and open the program. Click the in the left sidebar Laptop battery Possibility.
The system will show you the following information.
Take a look around and compare the values next to the Energy when full and Energy (design) Labels. Power Statistics also shows your battery capacity alongside capacitywhich in this case is 100%.
A simple comparison of the design capacity and the current capacity can give you an approximate idea of your battery condition. Lowering the screen brightness and using power management features in Linux can help you preserve your laptop's battery for longer.
Keeping an eye on inactive applications and closing them regularly can also save your laptop's battery life by reducing overall power consumption. You can also optimize your Linux computer, as this has a positive effect on the battery life.
Should you leave your laptop plugged in all the time?
Is it better to leave your laptop plugged in or use it on battery power? It turned out that the answer is not that easy.
About the author
(72 articles published)
Deepesh is Junior Editor for Linux at MUO. He has been writing informational content on the Internet for over 3 years. In his spare time he enjoys writing, listening to music and playing the guitar.
From Deepesh Sharma
Subscribe to our newsletter
Subscribe to our newsletter for tech tips, reviews, free e-books, and exclusive offers!
One more step …!
Please confirm your email address in the email we just sent you.
Expand to read the full story