aos battery
Battery presence and charge
3 commands. Run aos battery --help for the same list from the binary, or see every group.
Battery facts for laptops. status prints the charge and whether it is charging, percent prints a bare number for scripts, and present exits 0 or 1 so a script can branch on whether there is a battery at all. On a desktop, present exits 1 and the others say no battery. status also shows battery health where the OS reports it: full-charge capacity against design capacity (the Maximum Capacity figure in macOS System Settings), cycle count, and pack temperature.
Commands
Section titled “Commands”aos battery percent
Section titled “aos battery percent”Print the charge percentage as a bare number
Under WSL / SSH: runs on the Windows host (the machine with the screen). How the host works
aos battery percentaos battery percent # 87aos battery present
Section titled “aos battery present”Exit 0 when a battery is present, 1 otherwise
Under WSL / SSH: runs on the Windows host (the machine with the screen). How the host works
aos battery presentaos battery present && echo has a batteryaos battery status
Section titled “aos battery status”Print battery charge, charging state, and health (capacity, cycles) where reported
Under WSL / SSH: runs on the Windows host (the machine with the screen). How the host works
aos battery status [--json]| flag | values | meaning |
|---|---|---|
--json |
Optional |
aos battery status # 87% discharging 3:41 remaining (health 97%, 15 cycles, 30.7°C)aos battery status --json