Get OSX Battery percentage

pmset -g batt | egrep "([0-9]+\%).*" -o --colour=auto | cut -f1 -d';'
adjusting the field "f1" will give you additional information such as f1 = 98% f2 = discharging f3 = 2:02 remaining
Sample Output
98% #Get OSX Battery percentage

By: deshawnbw
2012-03-23 23:23:46

1 Alternatives + Submit Alt

What Others Think

mmm cut: bad delimiter
motionbug · 529 weeks ago
In this website we can see lots of information which is totally related to computer programming. So that I came in to a conclusion that this is exclusively made for the IT professionals.So I should share this website with my friend who are working in the IT field uber eats accident los angeles
leonamargret · 78 weeks ago
These kinds of command line interfaces are really helpful for students in order to learn these languages. I am so happy bulk apparel to see these kinds of sites because this one is really perfect for students in order to learn the commands. You have an option to ask questions to experts through the comments section.
Alyssalauren · 51 weeks and 1 day ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: