battery power in the command line

Tuesday, December 11, 2007

i use fluxbox (a small and light waight WM and for me the idea of using other apps even if they are small like conky, to monitor my battery seems like a waist so iv decided to inform you on how to check it simply with 1 command now since my pal over at www.thelinuxblog.com just made a post like exactly like this just to inform you i did not steal the idea haha we just think alike i guess....i acctualy just recently used this because of some reasons and was looking some stuff up about it whcih is why i decided to make a post about it...

code to see all neat info about your battery:

cat /proc/acpi/battery/BAT1/info
code to see things like a little less info but still usefull:

cat /proc/acpi/battery/BAT1/state
code to see the remaining battery capacity:

cat /proc/acpi/battery/BAT1/state | grep remaining
finaly to figure this out for percentage you need to devide this number by the total capacity of your batter which you can find with the above commands i know a little difficult but hey its good to know if your in a pinch and remember this is linux only cant do this in windows ....

also you may need to change the diriectory of your battery sometimes it can be in /proc/acpi/battery/BAT0/ rather then BAT1

pals over at thelinuxblog also mentioned something that i did no think of a program called yacpi which tells you all sorts of need power related information in your system...good stuff to know as well but be sure to check out that blog to read they have wonderful posts and many too.

0 comments: