Checking battery information on Linux assists with diagnosing power drain, estimating runtime, and planning battery replacement. Monitoring remaining charge, design capacity, and wear levels keeps mobile systems reliable during extended use.
Most modern laptops expose battery data through the Advanced Configuration and Power Interface (ACPI) and the kernel power subsystem. Values such as state, capacity, and voltage appear under /sys/class/power_supply, while user-facing tools like acpi and upower query the same data and present it in a more readable format.
Battery metrics can differ slightly between tools and may be unavailable in virtual machines or on systems without integrated batteries. Some utilities depend on desktop power services, and device names such as BAT0 or the UPower object path can vary between vendors. The commands below assume a typical laptop with a primary battery named BAT0; on different hardware, paths and identifiers may require adjustment.
Steps to check battery status in Linux:
- Open a terminal on the Linux system.
- Change to the /sys/class/power_supply directory where kernel power devices are exposed.
$ cd /sys/class/power_supply/
This directory contains entries for power sources such as AC adapters and batteries, commonly named AC0, BAT0, and similar.
- List the contents of the BAT0 directory to see available battery attributes.
$ ls /sys/class/power_supply/BAT0/ alarm capacity capacity_level charge_full charge_full_design charge_now current_now device present status technology voltage_now
Files in this directory expose battery data such as percentage, charging state, design charge, and current full charge capacity.
- Display the current battery charge percentage from the capacity file.
$ cat /sys/class/power_supply/BAT0/capacity 85
The value represents remaining charge as a percentage of the current full capacity rather than the original factory rating.
- Compare the current full charge with the design capacity to assess battery wear.
$ cat /sys/class/power_supply/BAT0/charge_full 7118000 $ cat /sys/class/power_supply/BAT0/charge_full_design 8157000
Values are typically reported in microamp-hours; dividing charge_full by charge_full_design yields an approximate health percentage, for example 7118 ÷ 8157 ≈ 0.87 or 87%.
- Check whether the battery is charging, discharging, or full by reading the status file.
$ cat /sys/class/power_supply/BAT0/status Discharging
Common states include Charging, Discharging, Not charging, and Full.
- Install the acpi package on Ubuntu or other Debian-based distributions if it is not already present.
$ sudo apt update && sudo apt install --assume-yes acpi
On other distributions, install the equivalent package using the native package manager, such as dnf, zypper, or pacman.
- Show a concise battery summary using the acpi command.
$ acpi --battery --details Battery 0: Discharging, 85%, 02:30:00 remaining Battery 0: design capacity 8157 mAh, last full capacity 7118 mAh = 87%
Output combines current percentage, time-remaining estimates, and a health calculation derived from design versus last full capacity.
- Retrieve extended battery details, including voltage and model information, using upower.
$ upower -i /org/freedesktop/UPower/devices/battery_BAT0 native-path: BAT0 vendor: Samsung SDI model: DELL TXF9M6C serial: 34075 state: discharging percentage: 85% capacity: 87.2625% voltage: 8.504 V ##### snipped #####
If the object path differs, list available power devices with
$ upower -e
and substitute the appropriate battery_* entry.
- Confirm that values from /sys, acpi, and upower agree within a small margin to validate that battery telemetry is consistent.
Minor differences between tools arise from rounding and update intervals, but large discrepancies can indicate stale data, driver issues, or misreported design capacity.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
Comment anonymously. Login not required.
