Linux For Cynics One user's experiences with Linux


Check your Laptop Battery Status from Command Line

The tool used to query laptop battery state is called acpi. In Ubuntu or Debian, install it like so:

$ sudo apt-get install acpi

Let's run it!

$ acpi

The output looks something like this:

Battery 0: Discharging, 99%, 02:34:33 remaining

There are various options for acpi we can use:

Check the temperature:

$ acpi -t


Thermal 0: ok, 48.0 degrees C
Thermal 1: ok, 48.0 degrees C

To check the AC power status

$ acpi -a 


AC Adapter 0: off-line

You can check all the status together:

$ acpi -V


Battery 0: Discharging, 96%, 02:33:55 remaining
Battery 0: design capacity 1773 mAh, last full capacity 1723 mAh = 97%
Adapter 0: off-line
Thermal 0: ok, 48.0 degrees C
Thermal 0: trip point 0 switches to mode critical at temperature 105.0 degrees C
Thermal 0: trip point 1 switches to mode passive at temperature 90.5 degrees C
Thermal 1: ok, 47.0 degrees C
Thermal 1: trip point 0 switches to mode critical at temperature 127.0 degrees C
Cooling 0: LCD 8 of 15
Cooling 1: Processor 0 of 10
Cooling 2: Processor 0 of 10

How To: Use External Monitor connected to Laptop with Closed Lid

This article assumes you are running Ubuntu 9.10 - 10.10 and gnome. It may apply to other similar setups.

Problem: You want to "dock" your laptop, attach it to an external monitor, and close the lid. When you do so, the screen turns off. So you go to System>Preferences>Power Management, but you find there is no "Do Nothing" option for On Lid Close. I am pretty sure there used to be such an option, but some bonehead removed it.

Solution: The option wasn't really removed, just "hidden" by our well-meaning bonehead. Fire up our good friend the terminal, and type:

gconftool-2 --type string --set /apps/gnome-power-manager/buttons/lid_ac "nothing"