Site icon Voina Blog (a tech warrior's blog)

Bash one liners: Detailed information about your battery and power under Linux command line

Advertisements

The magic command is upower, a command that gives you detailed information about the power devices in your laptop/desktop.

Enumerate all the power devices

9% ❯ upower --enumerate
/org/freedesktop/UPower/devices/line_power_AC
/org/freedesktop/UPower/devices/battery_BAT0
/org/freedesktop/UPower/devices/DisplayDevice

Check the details of a power device (battery in this case)

❯ upower -i /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          BAT0
  vendor:               Hewlett-Packard
  model:                Primary
  serial:               28716 2021/11/27
  power supply:         yes
  updated:              Tue 16 Aug 2022 09:36:50 AM EEST (50 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               charging
    warning-level:       none
    energy:              5.2896 Wh
    energy-empty:        0 Wh
    energy-full:         48.9858 Wh
    energy-full-design:  48.9858 Wh
    energy-rate:         23.6094 W
    voltage:             11.942 V
    time to full:        1.9 hours
    percentage:          10%
    capacity:            100%
    technology:          lithium-ion
    icon-name:          'battery-caution-charging-symbolic'
  History (charge):
    1660631810	10.000	charging
  History (rate):
    1660631810	23.609	charging
Exit mobile version