How to view battery information in Linux

How to view battery information in Linux

Battery information in Linux is provided by the ACPI (Advanced Configuration and Power Interface) daemon. You can view your battery information by using any of the following methods;

/proc filesystem

The easiest way to view battery information is by using the /proc filesystem.

To do that, run your favorite terminal program and execute the following command;

cat /proc/acpi/battery/BAT0/*

The following is the sample output of the command;

design voltage:          11100 mV
design capacity warning: 341 mWh
design capacity low:     0 mWh
capacity granularity 1:  100 mWh
capacity granularity 2:  0 mWh
model number:            Dell
serial number:           866
battery type:            LION
OEM info:                PANASONIC
present:                 yes
capacity state:          ok
charging state:          charged
present rate:            1 mW
remaining capacity:      3417 mWh
present voltage:         12408 mV

It displays some detailed information of your battery as provided by ACPI.

Notes

  • BAT0 is for your first battery. If you have more than one battery, you can use BAT1 and so on.
  • Running cat /proc/acpi/battery/BAT0/* will display the content of 3 files; /proc/acpi/battery/BAT0/alarm, /proc/acpi/battery/BAT0/info, and /proc/acpi/battery/BAT0/state. You can view individual file's content by running /proc/acpi/battery/BAT0/info and so on.

acpi

acpi is a program available for linux specifically to view ACPI related information for Linux. While it doesn't provide information as detailed as the above method, it provides useful enough information for most people.

To view basic battery information, run the following command at the terminal;

acpi

and you'll get the following output'

Battery 0: Full, 100%

To get more info from the command, add the -i option as the following;

acpi -i

and you'll get output as the following

Battery 0: Full, 100%
Battery 0: design capacity 411 mAh, last full capacity 275 mAh = 66%

Installation

If the program is not installed in your system, run the following command at the terminal if you're using Ubuntu to install it.

sudo apt-get install acpi
comments powered by Disqus