Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there a way to return the current watt consumption on the command line? I have found about the powertop program, but have not seen a way to return the Watt consumption as a value to the command line. I'm thinking of some file that I can cat or grep.

Using Arch Linux.

share|improve this question
add comment

2 Answers

up vote 8 down vote accepted

On my system I can obtain the power drawn from the battery from

cat /sys/class/power_supply/BAT0/power_now
9616000

The value seems to be in µW, though. You can convert it with any tool you're comfortable with, e.g. awk:

awk '{print $1*10^-6 " W"}' /sys/class/power_supply/BAT0/power_now
9.616 W
share|improve this answer
add comment

On a laptop by reading the ACPI data from either procfs or sysfs. On my system the files are:

/proc/acpi/battery/BAT0/state
/sys/bus/acpi/drivers/battery/PNP0C0A:00/power_supply/BAT0/power_now

Note that the sysfs is heavily symlinked so there are many ways to reach the file. power_now is the file name you are looking for.

share|improve this answer
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.