Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 8 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

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)))%

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

Your Answer


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.