Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I would like to specify that when I press the power button in my laptop, a 'shutdown -h now' command is sent, instead of bringing up the graphical shutdown menu. How can I do that on Ubuntu 11.10?

share|improve this question
add comment

1 Answer 1

up vote 8 down vote accepted

That's simple enough. When you press the power button a ACPI event triggers the script at /etc/acpi/powerbtn.sh.

You can edit that to just run shutdown -h now as the first thing so it looks like:

#!/bin/sh
# /etc/acpi/powerbtn.sh
# Initiates a shutdown when the power putton has been
# pressed.

/sbin/shutdown -h now "Power button pressed"
exit 0

# leave the old code below (in case you want to revert!)
share|improve this answer
    
Move your answer to the other one and we can close this as a dupe. –  Bruno Pereira Dec 9 '11 at 10:25
    
Works for Ubuntu 12.04 and 13.10 as well. –  elomage Jan 5 at 17:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.