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.

Possible Duplicate:
How to check battery status using terminal?

I want to find out whether my laptop is plugged in to AC power or not using the command line. How can I do this?

share|improve this question
add comment

marked as duplicate by Anwar Shah, Jorge Castro, Eliah Kagan, John S Gruber, Ringtail Sep 19 '12 at 3:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3 Answers

up vote 7 down vote accepted

Run the following command in a terminal for getting detailed info:

cat /proc/acpi/battery/BAT0/info

If you just want the state do:

cat /proc/acpi/battery/BAT0/state
share|improve this answer
Yes, it worked :) Thanks! –  infoquad Apr 19 '11 at 12:22
add comment

Install acpi, then use watch to continously monitor thru command line.


watch --interval=5 acpi -V

will show the information such as below and will update every 5 seconds.

Battery 0: Full, 100%, rate information unavailable
Battery 0: design capacity 6000 mAh, last full capacity 3424 mAh = 57%

Question is why would someone do this? Well, I have a laptop with broken LCD screen that I am now using as my bittorrent box.

share|improve this answer
add comment
cat /proc/acpi/ac_adapter/AC/state
share|improve this answer
not sure what you're talking about here. running it in the terminal gave cat: /proc/acpi/ac_adapter/AC0/state: No such file or directory –  infoquad Apr 19 '11 at 12:06
add comment

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