Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question tells me how I can find the state of my battery from the command line.

While this is useful information sometimes I need something quicker, basically like the percentage or enough for me to determine if I need to charge right away or if I can keep going for a bit longer without me having to care about milliwatts from catting my battery stats.

share|improve this question
add comment

2 Answers 2

up vote 6 down vote accepted

Here is an article on a package that can check your battery life at the command line.

Basically, all you have to do is:

sudo apt-get install acpi

acpi -V

share|improve this answer
add comment

You can do it without installing any extra packages:

$ echo $((100*$(sed -n "s/remaining capacity: *\(.*\) m[AW]h/\1/p" /proc/acpi/battery/BAT0/state)/$(sed -n "s/last full capacity: *\(.*\) m[AW]h/\1/p" /proc/acpi/battery/BAT0/info)))%
94%

This command is lifted from byobu's source. It might be a good candidate for a Bash alias.

share|improve this answer
    
+1 from me! CLI FTW. If you have 2 battery's change BAT0 for BAT1 :) –  Rinzwind Jun 10 '11 at 7:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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