Do we have a Linux/Ubuntu alternative for Windows' battery report where running powercfg /batteryreport on Windows' command prompt generates an actual html file showing the complete battery run time of the machine?

  • 1
    Not to my knowledge, there isn't really a command line that , but I can make one. Does it have to be specifically HTML ? because there exists already GUI application that does something similar Aug 27, 2016 at 3:21
  • Posted an answer, please check Aug 27, 2016 at 4:07

1 Answer 1


There is already an app that can show you graphical report of battery status. It is called Gnome Power Statistics and can be started via terminal as gnome-power-statistics or via searching Unity Dash. Here's how it looks like:

enter image description here

In case you insist on using HTML report and viewing it in your browser, here is a script that I made within 20 minutes or so, that displays battery info in your default browser.

import subprocess
import os

devs = [ line for line in subprocess.check_output(['upower','--enumerate']).decode().split('\n') ]
battery = [ item.strip() for item in devs if 'BAT' in item ]
report = subprocess.check_output(['upower','-i',battery[0]])
top = """
<header><title>This is title</title></header>
bottom = """

with open('report.html','w') as f:
    for line in report.decode().split('\n'):
        f.write('<p>' + line + '</p>\n' )

pid = subprocess.Popen(['xdg-open','report.html']).pid

Save this as simple_battery_report.py and run as

LC_ALL=C python  simple_battery_report.py`

And here's how it looks:

enter image description here

Note, this is not the most efficient solution, it doesn't refresh its information. I would strongly recommend using that other GUI app.

For command line enthusiasts here's this:

$ LC_ALL=C upower --enumerate |  awk '/BAT/'| xargs upower -i                                                            
  native-path:          BAT1
  vendor:               TOSHIBA
  model:                PABAS0241231
  serial:               0000000000000E6A
  power supply:         yes
  updated:              2016年08月26日 星期五 21时58分27秒 (117 seconds ago)
  has history:          yes
  has statistics:       yes
    present:             yes
    rechargeable:        yes
    state:               fully-charged
    warning-level:       none
    energy:              35.2388 Wh
    energy-empty:        0 Wh
    energy-full:         35.2536 Wh
    energy-full-design:  44.104 Wh
    energy-rate:         0.0148 W
    voltage:             16.887 V
    percentage:          100%
    capacity:            79.9329%
    technology:          lithium-ion
    icon-name:          'battery-full-charged-symbolic'
  • 2
    "Note, this is not the most efficient solution, it doesn't refresh its information. I would strongly recommend using that other GUI app." – not to mention that the GUI app has nice graphs about charge/discharge prediction accuracy! Aug 27, 2016 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.