Artificial intelligent assistant

Return value of current watt consumption on command line 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`.

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)

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy e61b01e933a8d62bd6cd511be91a6f65