How to Check Your Laptop’s Battery Health in Ubuntu Using the CLI

Want to check your battery health in Ubuntu from the command-line without any additional installations?

If you’re running Ubuntu on a laptop, you likely monitor your battery level from the top bar (I always enable battery percentage display in the top bar right after installing the OS), and switch to the Settings > Power panel for more detailed info when needed.

However, while this is sufficient for seeing your current battery level, it doesn’t provide any information on the health of your battery.

Fortunately, Ubuntu comes with the ‘Power Statistics’ tool. This utility offers a comprehensive view of your battery’s charge cycle, usage statistics, and overall health.

For those who frequently use the command line, accessing battery status through the CLI can be incredibly useful.

Observing that your laptop’s battery drains quicker and needs more frequent recharging could be attributed to various factors including CPU spikes, high system loads, background processes, incorrect settings, or even too many open browser tabs.

Alternatively, the issue might be with the battery itself. Over time, batteries degrade; they have limited life spans. There’s an old belief that fully discharging and then recharging a battery diminishes its capacity to hold charge — though it’s unclear if this is still considered true.

Regardless, if you’re looking to evaluate the health of your battery on Ubuntu, this can easily be done via a simple command line prompt, assuming you know your battery’s label. For clarity, we’ll use two commands in this guide.

Find Battery Capacity & Cycle Count from CLI

Using upower, we can check the battery vendor, model number, and capacity information, including current max capacity, original max capacity, cycle count, time to empty, and how much power is being drawn from the battery at the time the command is run.

  1. Open a new Terminal window.
  2. Enter the command upower --enumerate.
  3. Locate and copy the output path for your battery, typically ending in ‘_BAT0’.
  4. Input upower -i followed by a space, then insert the path you copied.

The path mentioned is commonly found in many laptops, though it might be different specific to your device.

As shown in the example, running the first command displays the battery path as /org/freedesktop/UPower/devices/battery_BAT0. The path is then used with the second command as upower -I /org/freedesktop/UPower/devices/battery_BAT0.

Reviewing the statistics provided offers insights into your battery’s health and performance.

The energy-full attribute represents the current maximum capacity your battery can store, while the energy-full-design attribute shows the capacity your battery had when it was new. Below that, the capacity attribute provides a percentage that represents how the current capacity compares to the original capacity.

In an example, originally a battery had a capacity of 53.9 Wh. Over time, this has decreased to 38.8 Wh, which means the current capacity is only 71.9% of the original capacity. This depreciation is considered decent for a laptop that is five years old.

Additionally, the charge-cycles attribute informs you about the total number of times the battery has been charged from completely drained to full. For instance, in one example, the battery was charged 194 times.

GUI options are available as well

And that’s how to check your battery health, capacity, and cycle count from the command line in Ubuntu using upower.

There are plenty of other ways to get battery information on Ubuntu, and the included Power Statistics app is more user-friendly. But if you prefer the command line, and you your info in one clean printout, then upower is worth knowing about.


Posted

in

by

Tags: