Battery information in Linux
is provided by the ACPI
(Advanced Configuration and Power Interface) daemon which is installed by default in most Linux
distributions. Monitored battery information is stored in the /sys
filesystem.
You can view your battery information by viewing the content of the files in the battery section of the /sys
filesystem or by using userland applications such as upower
or acpi
.
Battery information in Linux
can be viewed at the terminal via /sys
filesystem, upower
or acpi
.
/sys
filesystem. $ ls /sys/class/power_supply/BAT0/ alarm charge_full_design device present technology voltage_now capacity charge_now manufacturer serial_number type capacity_level current_now model_name status uevent charge_full cycle_count power subsystem voltage_min_design
$ cat /sys/class/power_supply/BAT0/capacity 100
upower
. $ upower -i /org/freedesktop/UPower/devices/battery_BAT0 native-path: BAT0 vendor: Samsung SDI model: DELL TXF9M6C serial: 34075 power supply: yes updated: Fri 05 Jul 2019 11:27:48 AM +08 (91 seconds ago) has history: yes has statistics: yes battery present: yes rechargeable: yes state: fully-charged warning-level: none energy: 54.0968 Wh energy-empty: 0 Wh energy-full: 54.0968 Wh energy-full-design: 61.9932 Wh energy-rate: 0 W voltage: 8.504 V percentage: 100% capacity: 87.2625% technology: lithium-polymer icon-name: 'battery-full-charged-symbolic'
acpi
userland application. $ sudo apt update && sudo apt install --assume-yes acpi # Ubuntu and Debian
acpi
. $ acpi Battery 0: Full, 100%
acpi
. $ acpi --battery --details Battery 0: Full, 100% Battery 0: design capacity 8157 mAh, last full capacity 7118 mAh = 87%
Comment anonymously. Login not required.