On a laptop running Apple's OS X oerating system, it is usually easy to check the state of the battery by just glancing at the top of the screen, but if you connect remotely to a system by Secure Shell (SSH) or just spend a lot of time at a command line interface (CLI), aka shell prompt, which you can obtain using the Terminal app, you may want a way to check the battery charge level by issuing a command from a command line. If so, you can use
pmset -g batt
(note: use "batt" not "battery").
$ pmset -g batt Currently drawing from 'AC Power' -InternalBattery-0 100%; charged; 0:00 remaining $ pmset -g batt Currently drawing from 'Battery Power' -InternalBattery-0 86%; discharging; (no estimate)
In the first instance of the command being issued above on a MacBook Pro laptop, the power cable was plugged into the laptop and it was charging. In the second instance, the power cable was disconnected and the internal battery is discharging.