Linux Laptop: Display Battery Status And Thermal Temperature From Command Line

by on July 7, 2010 · 4 comments· LAST UPDATED January 21, 2014

in , ,

How do I find out out details about my Linux Laptops temperature, battery status and other information from command prompt? How can I check battery status using terminal on Linux?

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:

Tutorial details
DifficultyEasy (rss)
Root privilegesYes
RequirementsNone
Estimated completion time2m
  • 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

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
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:

Fig.01: Linux Battery Monitor / Stats GUI App

Fig.01: Linux Battery Monitor / Stats GUI App

Related media



(Video 01: Linux Check Battery Status Using Terminal Command Line )

How Do I Get CPU Temperature Data?

How Do I Read Hard Disk Temperature?

See also
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 4 comments… read them below or add one }

1 rambo July 9, 2010 at 2:31 pm

how do i know the remaining battery in hours

Reply

2 Ahmed Mekki August 15, 2010 at 4:48 am

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

Reply

3 Al B. September 10, 2010 at 3:07 am

another command “ibam”

Reply

4 Spoom December 20, 2010 at 8:12 pm

Thanks, the information is much appreciated.

Reply

Leave a Comment

Tagged as: , , , ,

Previous Faq:

Next Faq: