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.
$ cd /sys/class/power_supply/
This directory contains entries for power sources such as AC adapters and batteries, commonly named AC0, BAT0, and similar.
$ ls /sys/class/power_supply/BAT0/ ls: cannot access '/sys/class/power_supply/BAT0/': No such file or directory
Files in this directory expose battery data such as percentage, charging state, design charge, and current full charge capacity.
$ cat /sys/class/power_supply/BAT0/capacity cat: /sys/class/power_supply/BAT0/capacity: No such file or directory
The value represents remaining charge as a percentage of the current full capacity rather than the original factory rating.
$ cat /sys/class/power_supply/BAT0/charge_full cat: /sys/class/power_supply/BAT0/charge_full: No such file or directory $ cat /sys/class/power_supply/BAT0/charge_full_design cat: /sys/class/power_supply/BAT0/charge_full_design: No such file or directory
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%.
$ cat /sys/class/power_supply/BAT0/status cat: /sys/class/power_supply/BAT0/status: No such file or directory
Common states include Charging, Discharging, Not charging, and Full.
$ sudo apt update && sudo apt install --assume-yes acpi WARNING: apt does not have a stable CLI interface. Use with caution in scripts. Hit:1 http://ports.ubuntu.com/ubuntu-ports noble InRelease Get:2 http://ports.ubuntu.com/ubuntu-ports noble-updates InRelease [126 kB] Hit:3 http://ports.ubuntu.com/ubuntu-ports noble-backports InRelease Hit:4 http://ports.ubuntu.com/ubuntu-ports noble-security InRelease Fetched 126 kB in 2s (68.2 kB/s) Reading package lists... Building dependency tree... Reading state information... 5 packages can be upgraded. Run 'apt list --upgradable' to see them. WARNING: apt does not have a stable CLI interface. Use with caution in scripts. Reading package lists... Building dependency tree... Reading state information... acpi is already the newest version (1.7-1.3build1). 0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
On other distributions, install the equivalent package using the native package manager, such as dnf, zypper, or pacman.
$ acpi --battery --details No support for device type: power_supply
Output combines current percentage, time-remaining estimates, and a health calculation derived from design versus last full capacity.
$ upower -i /org/freedesktop/UPower/devices/battery_BAT0
native-path: (null)
power supply: no
updated: Thu Jan 1 01:00:00 1970 (1768358221 seconds ago)
has history: no
has statistics: no
unknown
warning-level: unknown
battery-level: unknown
percentage: 0% (should be ignored)
icon-name: '(null)'
If the object path differs, list available power devices with
$ upower -e
and substitute the appropriate battery_* entry.
Minor differences between tools arise from rounding and update intervals, but large discrepancies can indicate stale data, driver issues, or misreported design capacity.