HOWTO monitor your battery from the console

Forum rules
Share your brain ;)
User avatar
bones
Clooney
Posts: 2385
Joined: Fri Jun 28, 2013 11:47 pm
Location: Cascadia

HOWTO monitor your battery from the console

Unread post by bones » Fri Aug 09, 2013 7:16 am

So, you've installed some version of LinuxBBQ on your laptop, and you're wondering how to monitor your battery life without some fancy-pants widget on a panel? You've got a couple of options.

For a very comprehensive output, without installing anything extra, open up a terminal window and enter:

Code: Select all

upower -i /org/freedesktop/UPower/devices/battery_BAT0
For a more simplified option, you could install acpi:

Code: Select all

sudo apt-get install acpi
To check the state of the charge of the battery:

Code: Select all

acpi
The output could be something like this:

Code: Select all

Battery 1: discharging, 44%, 00:18:48 remaining
To check the battery temperature:

Code: Select all

acpi -t
And the output could be:

Code: Select all

Battery 1: discharging, 37%, 00:15:59 remaining
Thermal 1: ok, 49.0 degrees C
If you need it in Fahrenheit:

Code: Select all

acpi -t -f
To check the AC power status:

Code: Select all

acpi -a 
The output could be:

Code: Select all

Battery 1: discharging, 30%, 00:13:31 remaining
AC Adapter 1: off-line
You can check all the states together:

Code: Select all

acpi -V
The output could be:

Code: Select all

Battery 1: discharging, 27%, 00:11:29 remaining
Thermal 1: ok, 50.0 degrees C
AC Adapter 1: off-line
Remember kids, xfce4-power-manager is bloat!

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: HOWTO monitor your battery from the console

Unread post by machinebacon » Fri Aug 09, 2013 7:22 am

Bump :)

Thanks for that - some version of the Q come with upower, others with acpi, others without any of them, so it was indeed a good idea to mention the possibilities there.
Maybe we should collectively write a little applet that can replace *-system-monitor and *-power-manager ...
..gnutella..

User avatar
DebianJoe
Frame Buffer
Posts: 1915
Joined: Mon Jul 01, 2013 5:41 am
Location: emacs.d

Re: HOWTO monitor your battery from the console

Unread post by DebianJoe » Sat Aug 10, 2013 12:18 am

machinebacon wrote:Maybe we should collectively write a little applet that can replace *-system-monitor and *-power-manager ...
Got a preference in languages? ;)

As much as I like writing about hacking emacs, I could use to get back on my new Elektra install and whipping out some little projects.

edit: @Ghost Pidsley, I'll get on those lisp-based WMs right now. Even though now that post doesn't exist, and you're starting to make me think that I'm crazier than has already been affirmed.
Last edited by DebianJoe on Sat Aug 10, 2013 2:14 am, edited 1 time in total.
|>>BBQ Roaster, Alpha Branch<< | >> clinky << | >> X11 must die << |
Thanks BASIC

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: HOWTO monitor your battery from the console

Unread post by pidsley » Sat Aug 10, 2013 2:14 am

^ damn. I thought I deleted that post about the WMs before you saw it. No pressure. I don't really care, and obviously no one else is beating down our doors because stumpwm doesn't work.

(edit) sorry about that. I tried to delete the post before you saw it. I need to go to sleep.

User avatar
paolo
Head Banger
Posts: 275
Joined: Mon Nov 12, 2012 11:08 am
Location: Milano,Italy

Re: HOWTO monitor your battery from the console

Unread post by paolo » Sat Aug 10, 2013 8:40 am

Thanks Bones !
Dell Latitude C640 - CPU P4 2GHz - RAM 1,5 GB - made in 2002 - I'm in the Manjaro-i3 land now :)

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: HOWTO monitor your battery from the console

Unread post by machinebacon » Sat Aug 10, 2013 9:03 am

@DebJoe: anything goes, I guess. Of course I like it as frugal as possible, so a nice bash wrapper for the TUI and something with a GUI. If it's bash, we can use yad (which I really like as interface for simple on/off/select/deselect switches)

I'll open a thread later today or tomorrow in the Dev section and link to it from here. Thanks!
..gnutella..

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: HOWTO monitor your battery from the console

Unread post by dkeg » Sat Aug 10, 2013 3:21 pm

nice bones, thanks for that.

I've been working on a small script to output conky information through dunst and set to a keybind. Call it when you need it. Still work in progress.

Work hard; Complain less

User avatar
bones
Clooney
Posts: 2385
Joined: Fri Jun 28, 2013 11:47 pm
Location: Cascadia

Re: HOWTO monitor your battery from the console

Unread post by bones » Sat Aug 10, 2013 3:43 pm

I love that a guy like me with nil programming skills can post something like this, and then you guys take it and run with it, brainstorming the hell outta that shit. :D

Post Reply