Posted by Weston Ganger
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: