How to check battery status in cli under Debian/Ubuntu based Linux?

You may need to install upower via sudo apt-get install upower first

use -e / –enumerate to list the devices:

‘peter@peter-MacBookPro ~ $ upower -e
/org/freedesktop/UPower/devices/line_power_ADP1
/org/freedesktop/UPower/devices/battery_BAT0

use -i / –show-info and the device path to show the details

peter@peter-MacBookPro ~ $ upower –show-info /org/freedesktop/UPower/devices/battery_BAT0
native-path: BAT0
vendor: *********************************
model: *********************************
power supply: yes
updated: Sat 14 Feb 2015 04:11:52 PM CST (9 seconds ago)
has history: yes
has statistics: yes
battery
present: yes
rechargeable: yes
state: discharging
energy: 7.63 Wh
energy-empty: 0 Wh
energy-full: 55.75 Wh
energy-full-design: 57.7 Wh
energy-rate: 15.946 W
voltage: 10.9 V
time to empty: 28.7 minutes
percentage: 13%
capacity: 96.6205%
History (charge):
1423901482 13.000 discharging
History (rate):
1423901512 15.946 discharging
1423901482 14.978 discharging
1423901452 14.740 discharging
1423901422 16.179 discharging

Easier method to show all details in one line command:

$ upower -e | xargs -n 1 upower -i
native-path: ADP1
power supply: yes
updated: Sat 14 Feb 2015 09:58:27 AM CST (22532 seconds ago)
has history: no
has statistics: no
line-power
online: no

native-path: BAT0
vendor: *********************************
model: *********************************
power supply: yes
updated: Sat 14 Feb 2015 04:13:52 PM CST (7 seconds ago)
has history: yes
has statistics: yes
battery
present: yes
rechargeable: yes
state: discharging
energy: 7.08 Wh
energy-empty: 0 Wh
energy-full: 55.75 Wh
energy-full-design: 57.7 Wh
energy-rate: 18.069 W
voltage: 10.846 V
time to empty: 23.5 minutes
percentage: 12%
capacity: 96.6205%
History (charge):
1423901602 12.000 discharging
History (rate):
1423901632 18.069 discharging
1423901602 16.164 discharging
1423901572 15.799 discharging
1423901542 16.767 discharging

Screenshot:
batteryCliStatusScreenshot

發表迴響