Sometimes the energy status applet on my gnome panel suddenly disappears.
Is there a simple command to print the loading state of the battery?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
There are different methods for this:
First, you could install the package acpi and run it like to:
It will show you the battery's current capacity and whether it's charging, discharging and how long it will last/take to be recharged if charging.
If you don't want to install new packages, there's also the proc filesystem to query:
cat /proc/acpi/battery/BAT0/state, which will give you the following output:
present: yes capacity state: ok charging state: charged present rate: 1 mA remaining capacity: 7800 mAh present voltage: 12062 mV
for more details on your battery, check
present: yes design capacity: 7800 mAh last full capacity: 2898 mAh battery technology: rechargeable design voltage: 11100 mV design capacity warning: 780 mAh design capacity low: 236 mAh cycle count: 0 capacity granularity 1: 78 mAh capacity granularity 2: 78 mAh model number: DELL WK3798 serial number: 1226 battery type: LION OEM info: Sanyo
Will give you the remaining capacity.
To check the maximum capacity, both last and designed.
Note that BAT0 is a name that can change between computer models.
You could execute
gnome-power-statistics just to see in the gui and help you with the panel problem (Just to add to the help). The correct answer would be:
lsto see what is the name of your Battery, could be BAT0, BAT1, etc..
You can also install acpi
sudo apt-get install acpi
acpi -b in console
It's pretty easy to write a script to check the battery level stuff.
When I was toying with ruby I wrote one here
It does require the gem for ansi/code for the coloring at the terminal.
The stuff with the BAT0 vs BAT1 is that on my laptop I had a second battery in the DVD drive bay so there were actually two to check.