3 Tools To Display Linux Laptop Battery Information From the Command Line

This article explains how to display Linux laptop battery information from the command line. Using the tools below, you'll be able to check the current battery discharging rate, the battery capacity (current, full and design), current battery voltage, temperature, and more.

1. Get laptop battery information from the command line using battop.

battop battery top Linux

battop, or rust-battop is an interactive viewer similar to top, htop and other such utilities, but for battery information / statistics. 

The tool runs on Linux, macOS, FreeBSD and DragonflyBSD (no Windows support yet) and it supports multiple batteries. As for the information it can display, this includes charge state, voltage, battery discharging rate, temperature (this didn't work for my laptop though), battery capacity information (current, when full, and full design), time to full / empty, charge cycles count, and more.

To install battop, grab the binary from the tool's GitHub releases page, and place it in your home folder. Next, use the following command to install it to /usr/local/bin:

sudo install battop-* /usr/local/bin/battop

You can also install battop from AUR on Arch Linux Manjaro, and from source, using cargo. See this page for details.

Once installed, to view your battery status and various info simply type battop in a terminal.

You might also like:  How To Limit Battery Charging (Set A Charge Threshold) For ASUS Laptops On Linux

2. Get Linux laptop battery information using UPower.

UPower is an abstraction for enumerating power devices, listening to device events and querying history and statistics. It comes with a command line tool (also called upower) that, among others, allows querying the battery history and statistics.

To use the UPower command line tool to get information / statistics about your Linux laptop battery, the first thing you need to do is figure out the battery path. This can be done with the UPower --enumerate (-e) command line flag, which enumerates object paths for devices:

upower -e

Here's the command with output from my ASUS laptop:

$ upower -e
/org/freedesktop/UPower/devices/line_power_AC0
/org/freedesktop/UPower/devices/battery_BAT0
/org/freedesktop/UPower/devices/DisplayDevice

The path you're looking for is the one that contains BAT at the end (it can be BAT0, BAT1, BATT, etc.) In this case, the battery path is /org/freedesktop/UPower/devices/battery_BAT0.

Now that we know the battery path, we can use the UPower command line tool to display information about the laptop battery (replace the path below with your battery's path, as explained above):

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

This is how the output of this command looks for my ASUS laptop:

$ upower -i /org/freedesktop/UPower/devices/battery_BAT0
native-path: BAT0
vendor: ASUSTeK
model: ASUS Battery
power supply: yes
updated: Wed 19 May 2021 11:13:41 (35 seconds ago)
has history: yes
has statistics: yes
battery
present: yes
rechargeable: yes
state: discharging
warning-level: none
energy: 36.509 Wh
energy-empty: 0 Wh
energy-full: 42.982 Wh
energy-full-design: 50.002 Wh
energy-rate: 12.969 W
voltage: 11.877 V
time to empty: 2.8 hours
percentage: 84%
capacity: 85.8426%
technology: lithium-ion
icon-name: 'battery-full-symbolic'
History (charge):
1621412021 84.000 discharging
History (rate):
1621412021 12.969 discharging

You might also like: Bwall Is An Animated Battery Wallpaper For Linux (Bash Script)

3. Get battery information from the command line using ACPI.

Another way of displaying the battery status from the command line on Linux is to use ACPI. This shows information from the /proc or the /sys filesystem, such as battery status or thermal information.

The acpi command line tool may not be installed by default. To install it, use:

  • Debian / Ubuntu / Linux Mint / Pop!_OS / Zorin OS / Elementary OS:
sudo apt install acpi

  • Fedora:
sudo dnf install acpi

  • Arch Linux / Manjaro:
sudo pacman -S acpi

To show all the battery information available via ACPI, run:

acpi -V

This is the command with output from my laptop:

$ acpi -V
Battery 0: Discharging, 81%, 02:35:35 remaining
Battery 0: design capacity 4209 mAh, last full capacity 3618 mAh = 85%
Adapter 0: off-line
Thermal 0: ok, 48.0 degrees C
Thermal 0: trip point 0 switches to mode critical at temperature 103.0 degrees C
Cooling 0: Processor 0 of 3
Cooling 1: SEN3 no state information available
Cooling 2: Processor 0 of 3
Cooling 3: pch_cannonlake no state information available
Cooling 4: Processor 0 of 3
Cooling 5: x86_pkg_temp no state information available
Cooling 6: Processor 0 of 3
Cooling 7: INT3400 Thermal no state information available
Cooling 8: Processor 0 of 3
Cooling 9: SEN2 no state information available
Cooling 10: Processor 0 of 3
Cooling 11: SEN4 no state information available
Cooling 12: Processor 0 of 3
Cooling 13: B0D4 no state information available
Cooling 14: intel_powerclamp no state information available
Cooling 15: iwlwifi_1 no state information available
Cooling 16: Processor 0 of 3
Cooling 17: SEN1 no state information available

Or you could only use acpi to show the current battery status, charge level, design and full capacity, using acpi -i. Example with output:

$ acpi -i
Battery 0: Discharging, 68%, 03:42:57 remaining
Battery 0: design capacity 4209 mAh, last full capacity 3618 mAh = 85%

You can also query ACPI for specific info, e.g. to show battery information only use -b, to show thermal information use -t, etc. See the ACPI help for details (acpi -h and man acpi).

More battery-related articles from Linux Uprising: