Another way to get information about your laptop battery when you are running Linux.

Posted: September 28, 2013. At: 5:04 PM. This was 4 years ago. Post ID: 6352
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

This command: upower -i /org/freedesktop/UPower/devices/battery_BAT0 will give you information about your laptop battery.

homer@neo:~/Documents$ upower -i /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:0c/PNP0C0A:00/power_supply/BAT0
  vendor:               PANASONIC
  model:                Li_Ion_4000mA
  serial:               0000
  power supply:         yes
  updated:              Sun Sep 29 02:39:34 2013 (3 seconds ago)
  has history:          yes
  has statistics:       yes
    present:             yes
    rechargeable:        yes
    state:               discharging
    energy:              27.2484 Wh
    energy-empty:        0 Wh
    energy-full:         45.414 Wh
    energy-full-design:  47.52 Wh
    energy-rate:         15.984 W
    voltage:             10.862 V
    time to empty:       1.7 hours
    percentage:          60%
    capacity:            95.5682%
    technology:          lithium-ion
  History (charge):
    1380386343	60.000	discharging
  History (rate):
    1380386374	15.984	discharging
    1380386343	16.351	discharging
    1380386312	16.243	discharging
    1380386281	17.528	discharging

Use grep with this command to see if you are connected to the power or the laptop is using the battery.

homer@neo:~/Documents$ upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep state:
    state:               discharging

You may also use the acpi command to get information about your laptop battery.

homer@neo:~/Documents$ acpi
Battery 0: Discharging, 52%, 01:27:04 remaining

These are very useful commands to know when you are using a laptop with Linux. Making it very easy to get information about your laptop hardware.

Here is a way to see if the laptop is open or shut.

homer@neo:~/Documents$ cat /proc/acpi/button/lid/LID0/state 
state:      open

I guess this could be useful if you are connecting to the laptop with SSH.

No comments have been made. Use this form to start the conversation :)

Leave a Reply