Getting information about power supply / battery

Manually getting information

Information about battery/power supply can be found and read manually by examining files in the /sys/class/power_supply/XYZ directory, which for example looks like this:

$ ls /sys/class/power_supply/BAT0/ | column -t
alarm
capacity
capacity_level
charge_behaviour
charge_control_end_threshold
charge_control_start_threshold
charge_start_threshold
charge_stop_threshold
cycle_count
device
energy_full
energy_full_design
energy_now
extensions
hwmon2
manufacturer
model_name
power
power_now
present
serial_number
status
subsystem
technology
type
uevent
voltage_min_design
voltage_now

To get the current state, if the battery is charging or discharging, or not present, you may cat the status file:

$ cat /sys/class/power_supply/BAT0/status
Discharging

Using the upower utility

Another option to get information about power supplies is using the upower command. First, enumerate the devices available to you:

$ upower -e
/org/freedesktop/UPower/devices/battery_BAT0
/org/freedesktop/UPower/devices/line_power_AC
/org/freedesktop/UPower/devices/line_power_ucsi_source_psy_USBC000o001
/org/freedesktop/UPower/devices/line_power_ucsi_source_psy_USBC000o002
/org/freedesktop/UPower/devices/DisplayDevice

Now you can get information about a specific entity from the list above:

$ upower -i /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          BAT0
  vendor:               BYD
  model:                5B11M90033
  serial:               989
  power supply:         yes
  updated:              Thu 15 May 2025 06:18:34 PM CEST (19 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
    warning-level:       none
    energy:              17.5 Wh
    energy-empty:        0 Wh
    energy-full:         48.48 Wh
    energy-full-design:  57 Wh
    energy-rate:         8.262 W
    voltage:             14.915 V
    charge-cycles:       296
    time to empty:       2.1 hours
    percentage:          36%
    capacity:            85.0526%
    technology:          lithium-polymer
    charge-start-threshold:        75%
    charge-end-threshold:          80%
    charge-threshold-supported:    yes
    icon-name:          'battery-good-symbolic'
  History (rate):
    1747325914  8.262   discharging
    1747325884  7.925   discharging
    1747325854  8.634   discharging
    1747325824  7.353   discharging