Linux Laptop Display Battery Status And Thermal Temperature From Command Line

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

Tutorial details
Difficulty Easy (rss)
Root privileges Yes
Requirements Linux Laptop
Time 2m
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.

Linux Laptop Display Battery Status And Thermal Temperature Command

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

Displaying Linux Laptop Battery Status Using the apci terminal command

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

From my Ubuntu LTS 20.04 Linux powered ThinkPad laptop:

[sudo] password for vivek: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  acpi tcl
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  acpitool
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 44.4 kB of archives.
After this operation, 147 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/universe amd64 acpitool amd64 0.5.1-5build1 [44.4 kB]
Fetched 44.4 kB in 1s (48.7 kB/s)   
Selecting previously unselected package acpitool.
(Reading database ... 293991 files and directories currently installed.)
Preparing to unpack .../acpitool_0.5.1-5build1_amd64.deb ...
Unpacking acpitool (0.5.1-5build1) ...
Setting up acpitool (0.5.1-5build1) ...
Processing triggers for man-db (2.9.1-1) ...

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
I guess it is a litter hot here:

temperature:             55 C

IBM and Thinkpad (Lenovo) laptop users please check /proc/acpi/ibm/ directory:
$ ls -l /proc/acpi/ibm/
Again from my office Thinkpad laptop:

-rw-r--r-- 1 root root 0 Oct  9 16:06 beep
-rw-r--r-- 1 root root 0 Oct  9 16:06 bluetooth
-r--r--r-- 1 root root 0 Oct  9 16:06 driver
-rw-r--r-- 1 root root 0 Oct  9 16:06 fan
-rw-r--r-- 1 root root 0 Oct  9 16:06 hotkey
-rw-r--r-- 1 root root 0 Oct  9 16:06 kbdlight
-rw-r--r-- 1 root root 0 Oct  9 16:06 lcdshadow
-rw-r--r-- 1 root root 0 Oct  9 16:06 led
-r--r--r-- 1 root root 0 Oct  9 16:06 thermal
-rw-r--r-- 1 root root 0 Oct  9 16:06 volume

Then I use the following cat command to see Thinkpad thermal details:
$ cat /proc/acpi/ibm/thermal

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
Here is what we see and make sure you explore all those files using the cat or less command/more command:

total 0
-rw-r--r-- 1 root root 4096 Oct  9 16:09 alarm
-r--r--r-- 1 root root 4096 Oct  9 13:11 capacity
-r--r--r-- 1 root root 4096 Oct  9 16:09 capacity_level
-rw-r--r-- 1 root root 4096 Oct  9 16:09 charge_start_threshold
-rw-r--r-- 1 root root 4096 Oct  9 16:09 charge_stop_threshold
-r--r--r-- 1 root root 4096 Oct  9 16:09 cycle_count
lrwxrwxrwx 1 root root    0 Oct  9 13:10 device -> ../../../PNP0C0A:00
-r--r--r-- 1 root root 4096 Oct  9 13:11 energy_full
-r--r--r-- 1 root root 4096 Oct  9 13:11 energy_full_design
-r--r--r-- 1 root root 4096 Oct  9 13:11 energy_now
drwxr-xr-x 3 root root    0 Oct  9 13:10 hwmon2
-r--r--r-- 1 root root 4096 Oct  9 13:11 manufacturer
-r--r--r-- 1 root root 4096 Oct  9 13:11 model_name
drwxr-xr-x 2 root root    0 Oct  9 16:09 power
-r--r--r-- 1 root root 4096 Oct  9 13:11 power_now
-r--r--r-- 1 root root 4096 Oct  9 13:11 present
-r--r--r-- 1 root root 4096 Oct  9 13:11 serial_number
-r--r--r-- 1 root root 4096 Oct  9 13:11 status
lrwxrwxrwx 1 root root    0 Oct  9 13:10 subsystem -> ../../../../../../../../../class/power_supply
-r--r--r-- 1 root root 4096 Oct  9 13:11 technology
-r--r--r-- 1 root root 4096 Oct  9 13:10 type
-rw-r--r-- 1 root root 4096 Oct  9 13:10 uevent
-r--r--r-- 1 root root 4096 Oct  9 13:11 voltage_min_design
-r--r--r-- 1 root root 4096 Oct  9 13:11 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

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?

Conclusion

You learned various Linux CLI and GUI options to view Linux laptop battery status. See the following man pages using the man command:
% man acpi
$ man upower
$ man proc


🐧 Please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
10 comments… add one
  • rambo Jul 9, 2010 @ 14:31

    how do i know the remaining battery in hours

    • Ahmed Mekki Aug 15, 2010 @ 4:48

      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

    • nanaon Oct 9, 2020 @ 4:02

      On some laptop, you had to configure it in BIOS setting.

  • Al B. Sep 10, 2010 @ 3:07

    another command “ibam”

  • Spoom Dec 20, 2010 @ 20:12

    Thanks, the information is much appreciated.

  • vaibhav Feb 17, 2015 @ 9:18

    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.

  • m Jun 10, 2017 @ 14:09

    This one has a nice interface:
    https://github.com/maks-a/batterym

  • Poolpog Nov 10, 2020 @ 17:26

    this post is helpful; however, “acpitool” and “acpi” are two separate CLI tools, and the instructions here combine the two in a confusing way. Confusing in that the installation examples don’t match the usage examples.
    Both “acpi” and “acpitool” do basically the same thing, though.

  • pujibabu Dec 11, 2020 @ 16:13

    Thanks for the informatiom

  • jay Dec 22, 2020 @ 6:57

    This isnt useful all that much. Instead, what really need in linux is beeping computer when battery reaches 80% charge, so as to maximize battery life because overcharging leads to poor lifespan. Android got it, why not linux?

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @ webmaster@cyberciti.biz