Get Battery Status in CLI
Get Battery Status in CLI
September 12, 2023·Suparna Ganguly,Christopher Tyler
From Suparna at https://www.linuxjournal.com/content/how-check-battery-status-using-linux-command-line
Use cat and find
The “cat” and “find” commands also help find details about your battery and power source.
Syntax
For the battery capacity, the syntax would be:
cat /sys/class/power_supply/BAT0/capacity
For more detailed battery information use the find command.
Syntax
And the syntax is,
find /sys/class/power_supply/BAT0/ -type f | xargs -tn1 cat