Skip to content

battery

Battery monitor with progress bar, temperature, health, cycles, signed current, and live mode (--watch). Shows what it can without root and fills in the fields that need root.

Basic usage

battery                  # single panel (one reading)
battery --watch 2        # refresh every 2 s (Ctrl+C to exit)
battery --watch 0.5      # every 500 ms (careful with screen heating)
battery --json           # one JSON reading
battery --json --watch 5 # one JSON line per reading (NDJSON)
battery --help

Panel fields

Field What Without root?
Level Current percentage ✅
Status Charging / Discharging / Full / Not charging ✅
Temperature °C (battery thermistor) ✅
Voltage V (current voltage) ✅
Health Good / Dead / Overheat / Over voltage / Unknown ✅
Technology Li-ion / Li-poly ✅
Cycles Charge cycle count (Android 12+) ❌
Current µA with sign (+ charging, − discharging) ❌
Power W (V × A) — how much power is in/out ❌
Mode Normal / Saver / Ultra saver ✅
Charger Yes/No (whether connected to a source) ✅

Fields marked "❌ without root" only appear with su -c dumpsys battery — without root, battery shows what Android lets Termux see via dumpsys directly or /sys/class/power_supply/.

--watch

Refreshes the panel in a loop. Use it to:

  • diagnose slow charging (negative current when it should be positive);
  • see if power saving is firing under load;
  • detect "battery drain" (very negative current at idle).
# leave it running in tmux/SSH
tmux new -s bat
battery --watch 2
# Ctrl+B D to detach; tmux a -t bat to reattach

--json

Structured output for scripts. Without --watch: one JSON object. With --watch: NDJSON (one JSON per line), easy to consume with jq:

battery --json --watch 5 | jq -c 'select(.current_ua < -500000) | {ts, current_ua, level}'

Schema

{
  "timestamp": "2026-11-28T15:32:11-04:00",
  "level": 87,
  "status": "Discharging",
  "temperature_c": 31.2,
  "voltage_v": 4.121,
  "health": "Good",
  "technology": "Li-ion",
  "cycles": 142,
  "current_ua": -213400,
  "power_w": -0.88,
  "power_save": false,
  "charger_connected": false,
  "method": "su"
}

method can be su, sudo, or sem root (no root). With no root, cycles, current_ua, power_w, and sometimes health come back as null.

Exit codes

Code Meaning
0 reading OK
1 failed to read any critical field
64 invalid usage

Privacy

battery does not read or send serial, IMEI, MAC, or any personal data. Only information exposed by BatteryManager and /sys/class/power_supply.

See also

  • Automation — low-battery alert via cron + --json.
  • Glossary — AOD/Doze, power saver, µA.