From Electron Cloud
(New page: This is a convention I wish somebody else had thought of and publicized widely a long time ago... there should be one memorable command to see the most relevant power and sensor info on ev...) |
(No difference)
|
Revision as of 15:21, 22 June 2009
This is a convention I wish somebody else had thought of and publicized widely a long time ago... there should be one memorable command to see the most relevant power and sensor info on every Linux box. My convention is to call this pow
. It has to be implemented differently on different systems, although that could be automated in some kind of complicated "pow" package which noone has written, AFAIK.
ACPI-compatible PCs
A shell alias might be good enough:
alias pow='cat /proc/acpi/battery/BAT1/info | grep last | cat - /proc/acpi/battery/BAT1/state /proc/acpi/thermal_zone/THRM/temperature'
or you could use a script:
#!/bin/sh CHARGE_NOW=`cat /sys/class/power_supply/BAT0/charge_now` CHARGE_FULL=`cat /sys/class/power_supply/BAT0/charge_full` CHARGE_PERCENT=$(( $CHARGE_NOW * 100 / $CHARGE_FULL )) CHARGE_NOW=`cat /proc/acpi/battery/BAT0/state | grep remaining | cut -c26-` CHARGE_FULL=`cat /proc/acpi/battery/BAT0/info | grep last | cut -c26-` cat /proc/acpi/battery/BAT0/state | grep -v remaining echo "Charge: $CHARGE_NOW / $CHARGE_FULL = $CHARGE_PERCENT%" cat /proc/acpi/thermal_zone/TZS0/temperature /proc/acpi/thermal_zone/TZS1/temperature
which produces output like this:
[acer][02:10:26 PM] pow present: yes capacity state: ok charging state: charging present rate: 2200 mA present voltage: 11663 mV Charge: 1606 mAh / 3799 mAh = 42% temperature: 45 C temperature: 48 C