Command Line – Return Value of Current Watt Consumption

power-management

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.

Best Answer

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

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

On Thinkpads if the tp_smapi module is loaded, the file is

cat /sys/devices/platform/smapi/BAT0/power_now

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

In case you cannot find the location within the sysfs file system, you can search for it:

find /sys -type f -name power_now 2>/dev/null

Additionally, the package lm-sensors may be used to determine the system power usage on some machines:

# sensors power_meter-acpi-0
power_meter-acpi-0
Adapter: ACPI interface
power1:      339.00 W  (interval =   1.00 s)
Related Question