Ubuntu can show your laptop's battery percentage in the desktop, but the terminal gives you more detail. You can check whether the battery is charging, estimate how long it may last, and compare its current full-charge capacity with its original design capacity.
The examples below focus on Ubuntu and Ubuntu-based distributions. Most commands only read battery information. Sample output is illustrative: names, percentages, units, and available fields vary by laptop and firmware.
1. Check battery status in Ubuntu Settings
On Ubuntu's GNOME desktop:
- Open Activities and search for Power.
- Open Settings, then select Power.
- Look under Batteries for charge percentage and charging or time-remaining information.
Ubuntu's top-bar battery menu also shows charge. This is the quickest option if you only need a current percentage; the terminal methods below expose additional details. The GNOME Help guide for checking battery status documents the Power panel and top-bar indicator used by Ubuntu's default GNOME desktop.
2. Use UPower, the usual Ubuntu desktop command-line view
UPower is the power service used by many Linux desktop environments. First check whether its command-line client is installed:
command -v upower
If it prints a path such as /usr/bin/upower, list the power devices UPower can see:
upower -e
Example device paths:
/org/freedesktop/UPower/devices/line_power_AC
/org/freedesktop/UPower/devices/battery_BAT0
Ask UPower for details about the battery path shown on your own laptop. The name may differ, so replace the example path with the one from upower -e:
upower -i /org/freedesktop/UPower/devices/battery_BAT0
Example fields from a battery that is discharging:
native-path: BAT0
power supply: yes
present: yes
state: discharging
energy: 32.76 Wh
energy-full: 42 Wh
energy-full-design: 50 Wh
energy-rate: 11.2 W
percentage: 78%
time to empty: 2.9 hours
The values above are an example, not a measurement from your computer. state tells you whether the battery is charging, discharging, full, or in another reported state. percentage is the current charge. time to empty is an estimate based on recent power use, so it can change as your workload changes. UPower documents -e/--enumerate, -i/--show-info, -b/--battery, and monitoring options in its command reference.
To print information for all battery devices at once, use:
upower -b
To watch for battery changes until you stop the command with Ctrl+C:
upower --monitor-detail
If upower is not installed
Ubuntu packages UPower as upower; it is available from Ubuntu's package repositories. On Ubuntu or an Ubuntu-based distribution that uses APT, install it with:
sudo apt update
sudo apt install upower
apt update refreshes the package index from your configured repositories. apt install upower downloads and installs the package and any required dependencies. Both commands need administrator privileges and change the system; review APT's proposed changes before confirming, and use the distribution's trusted repositories rather than downloading a package from an unverified site. The Ubuntu package index lists upower.
After installation, confirm the client is available and list the detected devices:
upower --version
upower -e
If you do not want to install a package, continue with the sysfs method below; it reads basic kernel battery files without UPower.
3. Read the kernel's battery files directly
Linux exposes power-supply information under /sys/class/power_supply/. These files are provided by the kernel and are normally readable without sudo. The exact device name and fields depend on the laptop.
List the available power-supply devices:
ls /sys/class/power_supply/
Example:
AC BAT0
Print the state and percentage for each battery whose standard status and capacity files are available:
for battery in /sys/class/power_supply/BAT*; do
[ -d "$battery" ] || continue
printf '%s\n' "${battery##*/}"
for field in status capacity; do
if [ -r "$battery/$field" ]; then
printf ' %s: ' "$field"
cat "$battery/$field"
fi
done
done
Illustrative output:
BAT0
status: Discharging
capacity: 78
The kernel power-supply interface defines attributes such as status, capacity, present, and energy/charge measurements. Some laptops expose only a subset. Read the Linux kernel power-supply documentation for the interface and units; do not write to sysfs files when you only want to inspect status.
You can inspect selected capacity fields without dumping every device attribute:
for battery in /sys/class/power_supply/BAT*; do
[ -d "$battery" ] || continue
for field in energy_now energy_full energy_full_design charge_now charge_full charge_full_design; do
if [ -r "$battery/$field" ]; then
printf '%s/%s: ' "${battery##*/}" "$field"
cat "$battery/$field"
fi
done
done
Energy values are commonly reported in microwatt-hours (µWh); charge values are commonly reported in microamp-hours (µAh). The kernel interface distinguishes energy from charge, and hardware may expose one family or the other. Do not compare numbers from different units as if they were interchangeable.
4. Use acpi for a compact report
The optional acpi utility can report battery state and, when firmware provides it, additional capacity details. Check first:
command -v acpi
If it is not installed and you want it, install the Ubuntu package from your configured repositories:
sudo apt install acpi
Installing a package changes the system and requires administrator privileges. Review the package-manager prompt before confirming. To display battery information and any additional capacity details the system provides, run:
acpi -bi
Illustrative output:
Battery 0: Discharging, 78%, 02:54:00 remaining
Battery 0: design capacity 5000 mAh, last full capacity 4200 mAh = 84% of design capacity
Output wording and units vary across acpi versions and hardware. The -b option requests battery information and -i requests additional details; see the Ubuntu acpi manual page. If the second line is absent, your firmware or driver may not expose those details through this interface.
5. Estimate battery capacity retention
Some devices report both a current full-charge capacity and an original design capacity. For example, UPower may show energy-full and energy-full-design, while sysfs may expose energy_full and energy_full_design.
If both values are available in the same unit, a rough capacity-retention estimate is:
current full-charge capacity ÷ design capacity × 100
Using the illustrative UPower values above:
42 Wh ÷ 50 Wh × 100 = 84%
This is an estimate, not a complete battery-health diagnosis. Firmware reporting, temperature, battery age, and the device's charging thresholds can affect the values. A reported 84% does not mean the laptop will run for exactly 84% of its original runtime. Runtime also depends on screen brightness, workload, peripherals, radio use, and power settings. The kernel documentation distinguishes design capacity from the most recently reported full-charge capacity; see its energy and charge attribute descriptions.
If Linux does not show a battery
Check the two sources without changing system configuration:
upower -e
ls /sys/class/power_supply/
If neither shows a battery device, the laptop firmware or kernel driver may not be reporting it. Check the laptop manufacturer's Linux support notes and firmware settings before trying driver workarounds. Do not load random kernel modules or write values into /sys based on an online command.
You normally do not need sudo to read the status, percentage, or standard capacity fields. If a particular file is unreadable, do not change its permissions; use UPower or acpi, or investigate why that device exposes different permissions. Before sharing diagnostic output publicly, remove serial numbers and other identifying device details.
Which method should you use?
- Ubuntu Settings: quickest graphical check.
- UPower: best first terminal choice on an Ubuntu desktop; reports state, percentage, estimated time and available capacity details.
/sys/class/power_supply: useful lightweight fallback that reads kernel-reported fields directly.acpi -bi: compact optional report, including capacity details when supported.
For a simple charge check, use Settings or UPower. For battery wear, compare the current full-charge capacity with design capacity when both are available, and treat the result as an estimate rather than a definitive health score.