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 following commands:
- 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./li>
- 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: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0
vendor: Samsung SDI
model: DELL 1C75X35
serial: 1820
power supply: yes
updated: Tuesday 21 January 2014 06:01:52 PM IST (1757 seconds ago)
has history: yes
has statistics: yes
battery
present: yes
rechargeable: yes
state: fully-charged
energy: 98.235 Wh
energy-empty: 0 Wh
energy-full: 98.235 Wh
energy-full-design: 98.235 Wh
energy-rate: 0.0111 W
voltage: 12.864 V
percentage: 100%
capacity: 100%
technology: lithium-ion
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:
$ sudo yum install acpitool
OR
$ sudo apt-get install acpitool
Sample outputs from Ubuntu LTS 12.04 laptop:
Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: nvidia-settings-experimental-310 Use 'apt-get autoremove' to remove them. The following NEW packages will be installed: acpitool 0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded. Need to get 46.3 kB of archives. After this operation, 156 kB of additional disk space will be used. Get:1 http://in.archive.ubuntu.com/ubuntu/ precise/universe acpitool amd64 0.5.1-3 [46.3 kB] Fetched 46.3 kB in 1s (37.6 kB/s) Selecting previously unselected package acpitool. (Reading database ... 539294 files and directories currently installed.) Unpacking acpitool (from .../acpitool_0.5.1-3_amd64.deb) ... Processing triggers for man-db ... Setting up acpitool (0.5.1-3) ...
Linux check battery command
Type the following command:
$ acpi -V
Sample outputs:
Battery 0: Full, 100% Battery 0: design capacity 8400 mAh, last full capacity 8044 mAh = 95% Adapter 0: on-line Thermal 0: ok, 53.5 degrees C Thermal 0: trip point 0 switches to mode critical at temperature 107.0 degrees C Cooling 0: LCD 0 of 15 Cooling 1: Processor 0 of 10 Cooling 2: Processor 0 of 10 Cooling 3: Processor 0 of 10 Cooling 4: Processor 0 of 10 Cooling 5: Processor 0 of 10 Cooling 6: Processor 0 of 10 Cooling 7: Processor 0 of 10
To just see status, enter:
$ acpi
Sample outputs:
Battery 0: Charging, 17%, 01:20:06 until charged
See ac adapter information
$ acpi -a
Sample outputs:
Adapter 0: on-line
The above output indicates that laptop is plugged in use i.e. connected.
Show thermal information
$ acpi -t
Sample outputs
Thermal 0: ok, 39.5 degrees C
To use fahrenheit as the temperature unit:
$ acpi -tf
To use kelvin as the temperature unit:
$ acpi -tk
Use /proc/acpi/ directory to get laptop battery info (deprecated method)
You can browse the same data by visiting /proc/acpi/ directory:
$ cd /proc/acpi/
$ ls -l
Sample outputs:
dr-xr-xr-x 3 root root 0 2010-07-07 14:29 ac_adapter dr-xr-xr-x 3 root root 0 2010-07-07 14:29 battery dr-xr-xr-x 5 root root 0 2010-07-07 14:29 button -r-------- 1 root root 0 2010-07-07 14:29 dsdt dr-xr-xr-x 3 root root 0 2010-07-07 14:29 embedded_controller -r-------- 1 root root 0 2010-07-07 13:14 event -r-------- 1 root root 0 2010-07-07 14:29 fadt dr-xr-xr-x 2 root root 0 2010-07-07 14:29 fan -r--r--r-- 1 root root 0 2010-07-07 14:29 info dr-xr-xr-x 2 root root 0 2010-07-07 14:29 power_resource dr-xr-xr-x 10 root root 0 2010-07-07 14:29 processor -rw-r--r-- 1 root root 0 2010-07-07 14:29 sleep dr-xr-xr-x 3 root root 0 2010-07-07 14:29 thermal_zone dr-xr-xr-x 3 root root 0 2010-07-07 13:14 video -rw-r--r-- 1 root root 0 2010-07-07 14:29 wakeup
OR
$ cat /proc/acpi/thermal_zone/THM/temperature
Sample outputs:
temperature: 55 C
Use /sys/class/power_supply/BAT0/ directory to get battery info
As of Linux kernel 2.6.x you need to use /sys/class/power_supply/BAT0 directory:
$ ls -l /sys/class/power_supply/BAT0
Sample outputs:
total 0 -rw-r--r-- 1 root root 4096 Jan 21 18:13 alarm -r--r--r-- 1 root root 4096 Jan 21 18:01 charge_full -r--r--r-- 1 root root 4096 Jan 21 18:01 charge_full_design -r--r--r-- 1 root root 4096 Jan 21 18:01 charge_now -r--r--r-- 1 root root 4096 Jan 21 18:01 current_now -r--r--r-- 1 root root 4096 Jan 21 18:13 cycle_count lrwxrwxrwx 1 root root 0 Jan 21 18:13 device -> ../../../PNP0C0A:00 -r--r--r-- 1 root root 4096 Jan 21 18:01 manufacturer -r--r--r-- 1 root root 4096 Jan 21 18:01 model_name drwxr-xr-x 2 root root 0 Jan 21 18:13 power -r--r--r-- 1 root root 4096 Jan 21 18:01 present -r--r--r-- 1 root root 4096 Jan 21 18:01 serial_number -r--r--r-- 1 root root 4096 Jan 21 18:01 status lrwxrwxrwx 1 root root 0 Jan 21 18:01 subsystem -> ../../../../../../class/power_supply -r--r--r-- 1 root root 4096 Jan 21 18:01 technology -r--r--r-- 1 root root 4096 Jan 21 18:01 type -rw-r--r-- 1 root root 4096 Jan 21 18:01 uevent -r--r--r-- 1 root root 4096 Jan 21 18:01 voltage_min_design -r--r--r-- 1 root root 4096 Jan 21 18:01 voltage_now
Use GUI tool find out battery status on Linux
The gnome-power-statistics is the gui program for the gnome power management infrastructure. It allows users to visualize the power consumption of laptop hardware. Type the following command to view stats or click on GUI power icon located on right side:
$ gnome-power-statistics
Sample outputs:
Related media
(Video 01: Linux Check Battery Status Using Terminal Command Line )
How Do I Get CPU Temperature Data?
- See our FAQ: Linux Read CPU Temperature Sensor Chip Data
How Do I Read Hard Disk Temperature?
- See our Tip: Linux: Monitor hard disks temperature with hddtemp
See also
- Man pages: acpi(1),upower(1),proc(5)



6 comment
how do i know the remaining battery in hours
rambo:
when your power adapter off
you will have some thing like that
———————————————————-
root@null:/home/null# acpi -V
Battery 0: Discharging, 93%, 03:27:15 remaining
Battery 0: design capacity 2251 mAh, last full capacity 2251 mAh = 100%
Adapter 0: off-line
———————————————————
this will show you the remaining by hour .
the example in this tutorials show it as power adapter on.
thank you
another command “ibam”
Thanks, the information is much appreciated.
Hi,
Is there any System Hardware API for Dell on Linux.we are using java technology. We want to API in java. Please help me.
This one has a nice interface:
https://github.com/maks-a/batterym