How to switch off a screen laptop under Linux

In this post, I describe how to write a shell script that switches off a laptop screen. The instructions are tested with Ubuntu Linux 5.10 (Breezy) on a Dell Latitude C810.

First, set the governor for the CPU frequency with the following command.

echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

This command can be run automatically at run-level 2 by putting it in /etc/rc2.d/S30freq-scaling.

Out of the box Breezy is configured to manage power, but we need additional configuration for some laptops.

First, on the C810 the kernel needs the acpi_irq_balance option in order to report certain ACPI events (for example, closing the lid). We fix this by adding the kernel option acpi_irq_balance in GRUB’s menu.lst.

title           Ubuntu, kernel 2.6.12-9-686 
root            (hd0,0)
kernel          /boot/vmlinuz-2.6.12-9-686 root=/dev/hda1 acpi_irq_balance ro quiet splash resume=/dev/hda5
initrd          /boot/initrd.img-2.6.12-9-686

Second, it seems that the command xset dpms force off does not switch off the screen. Instead, we must use the command vbetool to do this. Although it is reported to cause unexpected behaviour, it works with the C810.

After configuring the kernel as describe above, we can write the script /etc/acpi/ to turn on and to turn off the laptop screen.


case "$1" in
                /usr/sbin/vbetool dpms on
                /usr/sbin/vbetool dpms off
                echo "Usage: $N {on|off}"


The script takes as argument on or off, as in the example below.

/etc/acpi/ off

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.