Checking your laptop battery from the command line is rather easy using the upower command. This article is an introduction to the Linux upower command and an example from my Linux laptop which is used as a PHP Programming test server.\n\n\n\nBackground\n\n\n\nI have 2 laptops that I use as test servers. They were cheap so I bought one for my wife and one for me. We never really used them so I converted them into PHP programming test servers.\n\n\n\nOriginally I took the batteries out and stored them away from the computers because we were not using them as portal devices.\n\n\n\nTheses computers are probably 4 years old. One battery is dead. Surprisingly the other battery appears to be in like new condition. It has been about 8 months since I changed the good battery and today it is showing 35% charged. It has been setting in my desk drawer.\n\n\n\nThe local Linux community tells me to keep my battery charged between 30 and 70 percent. They say anything below 30% will add extra wear to the battery as will any charge over 70%.\n\n\n\nCurrently I do not need the battery, however I may want to load something Like Mint Linux on this computer and use it as a mobile Linux computer. Therefore I would like to keep the battery in good condition and that is why I periodically charge the battery.\n\n\n\nMonitoring Laptop Battery Charge\n\n\n\nMy laptop is running Ubuntu 16.04lts and I had to add the upower package. From the command line it is rather easy \u2013 two steps.\n\n\n\nsudo apt-get updatesudo apt-get install upower\n\n\n\nThis morning I put the good battery into my laptop and ran \u201cupower -i\u201d \/org\/freedesktop\/Upower\/devices\/battery_BAT0 from the command line. Here is the output:\n\n\n\nNotice my battery is at 37% change. Amazing!! I was expecting the battery to be dead.\n\n\n\nTo determine just the state of the battery, time to fully charge, and the percentage of charge, run the following command on the command line.\n\n\n\nupower -i $(upower -e | grep BAT) | grep \u2013color=never -E \u201cstate|to\\ full|to\\ empty|percentage\u201d\n\n\n\nHere is the output from my laptop:\n\n\n\nSince I am only charging my battery to 70%, I expect a much shorter charge time than what a full charge would take. It show it would take 1.7 hours for to fully charge.\n\n\n\nUpower Man Page\n\n\n\nYou can learn more by running \u201cman upower\u201d on the Linux command line. The man page does not give much information, however for my needs, I do not need anything more than is documented in this article.\n\n\n\nConclusion\n\n\n\nYou may need to install the upower package which is very simple. I provide the command necessary to install the package from the command line on Debian and it\u2019s derivative Linux distributions, such as Ubuntu 16.04lts.\n\n\n\nIf you need a simple way to monitor your laptop battery from the command line upower may be all you need.