Battery related information

From Notes_Wiki
Revision as of 10:02, 13 January 2013 by Saurabh (talk | contribs) (Created page with "<yambe:breadcrumb>Information_tools|Information tools</yambe:breadcrumb> =Battery related information= In case of laptops one may want battery related information on command-...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<yambe:breadcrumb>Information_tools|Information tools</yambe:breadcrumb>

Battery related information

In case of laptops one may want battery related information on command-line. To get battery information from command line use:

cat /proc/acpi/battery/BAT0/{info,state}

If only percentage of battery life is desired then following command can be used:

echo $((100*$(sed -n "s/remaining capacity: *\(.*\) m[AW]h/\1/p" /proc/acpi/battery/BAT0/state)/$(sed -n "s/last full capacity: *\(.*\) m[AW]h/\1/p" /proc/acpi/battery/BAT0/info)))%