Apple

How To Get The Battery Life On Your OSX Laptop From The Terminal

Posted by Weston Ganger on May 26, 2016

For a while I was using SSH to develop on my MacBook from my main desktop. I wanted to keep the battery healthy so sometimes I left it unplugged. I wanted a simple way to get the battery life without actually checking my MacBook.

You can use this command in the terminal to get the battery life percentage.


pmset -g batt | egrep "([0-9]+\%).*" -o --colour=auto | cut -f1 -d";"

Best to create a bash alias for this:


# ~/.bash_aliases
alias bl='pmset -g batt | egrep "([0-9]+\%).*" -o --colour=auto | cut -f1 -d";"'


Related External Links:


Posted in OSX and Tagged with osx battery 


Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts