It's pretty interesting to get battery information from command line.
What we need first is the files containing the battery information which is stored in
And then we should get to know the battery information. We use
cat capacity status
to print the the capacity and the status(charging or discharging) of the battery to the screen.
Last but not least, add some interesting stuff to this tool we created. Just like last line of the script below.
echo "Battery Information:"
cat capacity status | cowsay -f meow
Save this three lines to a file called "PowerInformation"(or whatever you like), and make it executable
chmod +x PowerInformation
cp the file to /bin/ (or make a symbolic link to /bin/)
sudo cp PowerInformation /bin/
(You should install cowsay by using
sudo apt-get install cowsay first if you don't have it.)
PowerInformation to let a cat to tell you your battery information.
You can choose other animal. Use
cowsay -l to get the animal list, then change "meow" in the script to you favorite animal.
Pretty cool. Have fun.:-)