I do not always want to open System Settings just to see the battery. Terminal has a getter for it, and reading does not need sudo.
The man page says -g batt, or the equivalent -g ps, displays the status of batteries and UPSs:
pmset -g batt
It shows the state of all attached power sources, which makes it easy to use in a script. The man page also lists a few other getters:
pmset -g pslogdisplays an ongoing log of power source state, until you press Control-Cpmset -g rawlogdisplays an ongoing log of the battery state as read directly from the batterypmset -g assertionssummarizes the power assertions that may prevent system sleep or display sleeppmset -g thermshows thermal conditions that affect CPU speed, and-g thermloglogs such notifications
The man page says pslog and rawlog are normally used for debugging, for example to isolate a problem with an aging battery. The assertions list is the one I would open when a Mac will not sleep, since assertions are what can prevent system sleep or display sleep.
The caveats come from the same page. The thermal getters are not available on all platforms, and the assertions getters are listed as available from 10.6 and later. Also, pmset must be run as root only to modify settings. The getters are safe, but the same command with a setting name, such as displaysleep 5, changes how your Mac behaves, so read the line you paste before you press Return.
Further reading: pmset man page