Get The Battery Life On Your OSX Laptop From The Terminal

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.

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

Related External Links:

Article Topic:Software Development - OSX

Date:May 26, 2016