Debian, Ubuntu

How to display battery status from command line

Introduction.

The information regarding your battery status and ACPI is stored in /proc and /sys file system. The easiest way to read this information is using the various commands line option tools as well as GUI tool on Linux operating system.

upower command: a command line tool for UPower which provides an interface to enumerate power sources on the system and control system-wide power management.
acpi command: shows battery status and other ACPI information from /proc and /sys file system.
/sys/class/power_supply/BAT0/ directory: store ACPI information about your first battery.

Use upower command to check battery status from command line
Type the following command

upower -i /org/freedesktop/UPower/devices/battery_BAT0

Sample outputs:

  native-path:          BAT0
  vendor:               ASUSTeK
  model:                N56--52
  power supply:         yes
  updated:              2019 m. lapkričio 02 d. 18:52:55 (32 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               charging
    warning-level:       none
    energy:              6,593 Wh
    energy-empty:        0 Wh
    energy-full:         20,257 Wh
    energy-full-design:  48,84 Wh
    energy-rate:         27,539 W
    voltage:             11,1 V
    time to full:        29,8 minutes
    percentage:          32%
    capacity:            41,4762%
    technology:          lithium-ion
    icon-name:          'battery-good-charging-symbolic'
  History (charge):
    1572713575	32,000	charging
  History (rate):
    1572713575	27,539	charging

Use apci command to check battery status using terminal
The acpi command may not be installed by default so use apt-get command or yum command to install the same:
CentOS

yum install acpitool

Ubuntu / Debian

apt-get install acpitool

Sample outputs from Ubuntu 19.10 laptop:

  Battery #1     : Charging, 55.56%, 00:20:00
  AC adapter     : online 
  Thermal info   : 

Linux check battery command

Type the following command:

acpi -V

Sample outputs:

Battery 0: Charging, 60%, 00:18:52 until charged
Battery 0: design capacity 4400 mAh, last full capacity 1824 mAh = 41%
Adapter 0: on-line
Thermal 0: ok, 46.0 degrees C
Thermal 0: trip point 0 switches to mode critical at temperature 108.0 degrees C
Thermal 0: trip point 1 switches to mode passive at temperature 110.0 degrees C
Cooling 0: Processor 0 of 3
Cooling 1: Processor 0 of 3
Cooling 2: Processor 0 of 3
Cooling 3: Processor 0 of 3
Cooling 4: x86_pkg_temp no state information available
Cooling 5: Processor 0 of 3
Cooling 6: Processor 0 of 3
Cooling 7: Processor 0 of 3
Cooling 8: intel_powerclamp no state information available
Cooling 9: Processor 0 of 3

To just see status, enter:

acpi

Sample outputs:

Battery 0: Charging, 61%, 00:18:42 until charged