Today I Learned
Search…
Check battery status
Posted on 11 Sep, 2021

Linux

1
upower -i /org/freedesktop/UPower/devices/battery_BAT0 | awk '/percentage/ {print $2}'
Copied!

MacOS

1
pmset -g batt | awk '/discharging/ {print $3}' | tr -d ";"
Copied!
Copy link
Edit on GitHub
Contents
Linux
MacOS