Difference between revisions of "Battery related information"
From Notes_Wiki
m |
m |
||
Line 1: | Line 1: | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Information tools]] > [[Battery related information]] | |||
'''More updated articles are available at [[CentOS 7.x laptop battery]]''' | '''More updated articles are available at [[CentOS 7.x laptop battery]]''' | ||
Line 13: | Line 12: | ||
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)))% | 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)))% | ||
</pre> | </pre> | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Information tools]] > [[Battery related information]] |
Latest revision as of 14:50, 24 August 2022
Home > CentOS > CentOS 6.x > Information tools > Battery related information
More updated articles are available at CentOS 7.x laptop battery
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)))%
Home > CentOS > CentOS 6.x > Information tools > Battery related information