I use Debian and I want my power button to shutdown the PC. Currently it sleeps, when I press it.

Is there any command for it to make it shutdown?


3 Answers 3


/etc/acpi/events/powerbtn-acpi-support leads to /etc/acpi/powerbtn-acpi-support.sh, which in turns calls for /etc/acpi/powerbtn.sh. I've not tested, but you may try to create this file and fill it with something like


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

Note that in principle it won't exit your session cleanly, though, so depending on the desktop environment / window manager you use you may want to improve it to handle things more cleanly (e.g. adding gnome-session-save --kill before if you use gnome).

The best way to go would probably be to google search for other users /etc/acpi/powerbtn.sh scripts.


/etc/acpi is not used anymore (probably after Debian Wheezy), see /etc/systemd/logind.conf, more info in this answer.


For modern Debian versions with systemd (>=Debian 8.0 Jessie)

Make sure you have acpid installed:

apt-get -y install acpid

and edit /etc/systemd/logind.conf to uncomment:


See systemd logind.conf man page for more options.

For older Debian releases (<=Debian 7)

See Skippy's answer

Credits: Michls Tech Blog


Some while ago I created this handy script: https://github.com/stackcoder/doublepress It can prevent accidental shutdowns by requiring double pressing the power button. It also allows switching between standby and poweroff, or triggers your custom action.

  • This does not actually address the issue in the question at all.
    – Kusalananda
    Jan 21, 2021 at 8:28
  • You could salvage this answer by addressing the Question "Is there any command for it to make it shutdown?" How would the OP acquire, configure, and/or use the script to solve their problem?
    – Jeff Schaller
    Jan 21, 2021 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy