This command: upower -i /org/freedesktop/UPower/devices/battery_BAT0
will give you information about your laptop battery.
homer@neo:~/Documents$ upower -i /org/freedesktop/UPower/devices/battery_BAT0 native-path: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:0c/PNP0C0A:00/power_supply/BAT0 vendor: PANASONIC model: Li_Ion_4000mA serial: 0000 power supply: yes updated: Sun Sep 29 02:39:34 2013 (3 seconds ago) has history: yes has statistics: yes battery present: yes rechargeable: yes state: discharging energy: 27.2484 Wh energy-empty: 0 Wh energy-full: 45.414 Wh energy-full-design: 47.52 Wh energy-rate: 15.984 W voltage: 10.862 V time to empty: 1.7 hours percentage: 60% capacity: 95.5682% technology: lithium-ion History (charge): 1380386343 60.000 discharging History (rate): 1380386374 15.984 discharging 1380386343 16.351 discharging 1380386312 16.243 discharging 1380386281 17.528 discharging |
Use grep with this command to see if you are connected to the power or the laptop is using the battery.
homer@neo:~/Documents$ upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep state: state: discharging |
You may also use the acpi command to get information about your laptop battery.
homer@neo:~/Documents$ acpi Battery 0: Discharging, 52%, 01:27:04 remaining |
These are very useful commands to know when you are using a laptop with Linux. Making it very easy to get information about your laptop hardware.
Here is a way to see if the laptop is open or shut.
homer@neo:~/Documents$ cat /proc/acpi/button/lid/LID0/state state: open |
I guess this could be useful if you are connecting to the laptop with SSH.