linux cmd - gpk2000/Wiki GitHub Wiki

Useful Linux Commands

Get all the information about your laptop battery

You will need to install upower on your linux distribution. You can either use package provided by your package manager or build it from source.

Use upower -e to get the info about your devices, my output is

/org/freedesktop/UPower/devices/line_power_ACAD
/org/freedesktop/UPower/devices/battery_BAT1
/org/freedesktop/UPower/devices/DisplayDevice

As you can see there is a battery device, now type upower -i (short for show info of device) and specify your device, my output for upower -i /org/freedesktop/UPower/devices/battery_BAT1 is

 native-path:          BAT1
  vendor:               Hewlett-Packard
  model:                PABAS0241231
  serial:               41167
  power supply:         yes
  updated:              Tue 07 Sep 2021 11:27:58 AM IST (56 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
    warning-level:       none
    energy:              11.7822 Wh
    energy-empty:        0 Wh
    energy-full:         33.6384 Wh
    energy-full-design:  32.12 Wh
    energy-rate:         6.10071 W
    voltage:             14.31 V
    time to empty:       1.9 hours
    percentage:          35%
    capacity:            100%
    technology:          lithium-ion
    icon-name:          'battery-good-symbolic'
  History (rate):
    1630994278	6.101	discharging