Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 13 down vote accepted

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

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

# /etc/acpi/
# 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 '14 at 17:56

Your Answer


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.