How can I determine the battery level of my magic mouse from the command line? I know how to get it through the menubar, but how can I get it via the command line?
Use ioreg and search for battery using grep 


Check the battery level of connected bluetooth headphones from the command line?


Since ioreg is really verbose - here is one command that cuts down to the names of bluetooth devices and all percentage of battery for each.

ioreg -l |egrep "BatteryPercent|Bluetooth Product Name"