How to Get Mac Battery Level from Command Line

Publikováno: 10.4.2023

I’m a big fan of having as much information as I can get within the command line. I couldn’t go without knowing which git branch I’m on, for example. Another important piece of information I like having is my current battery percentage. To get the current battery level from command line, you can run: pmset […]

The post How to Get Mac Battery Level from Command Line appeared first on David Walsh Blog.

Celý článek

I’m a big fan of having as much information as I can get within the command line. I couldn’t go without knowing which git branch I’m on, for example. Another important piece of information I like having is my current battery percentage.

To get the current battery level from command line, you can run:

pmset -g batt | grep -Eo "\d+%"

Since I get lost in command line for hours at a time, having the percentage present saves me the labor of shifting my eyes outside of shell. What information do you like having in your command line?

The post How to Get Mac Battery Level from Command Line appeared first on David Walsh Blog.

Nahoru
Tento web používá k poskytování služeb a analýze návštěvnosti soubory cookie. Používáním tohoto webu s tímto souhlasíte. Další informace