Change Power Button Behavior in Ubuntu Linux
The power button on your Ubuntu Linux PC does more than just turn the computer on. You can change what happens when you press it while the system is running. This guide shows you how to adjust these settings for 2026.
Why change power button behavior?
You might want to stop the computer from turning off if you accidentally bump the button. Or, you might want a quick way to put your PC to sleep. Changing this setting lets you control exactly what happens when you press that button.
What happens when done?
Once you save your changes, your computer will follow your new rule every time you press the physical power button. If you choose “Nothing,” the button will simply do nothing at all.
Introduction
You can manage power button actions through the graphical interface or via system files. For advanced users who prefer the command line, you can edit the /etc/systemd/logind.conf file. By modifying this file, you can control power button events at the systemd level, which overrides standard desktop settings.
How to change power button behavior in Ubuntu Linux
Ubuntu uses a central location for settings. Note that the path may vary slightly depending on your specific version of GNOME.
Open the Activities overview and type Settings to begin %%LNK0%%.

Alternatively, click the System menu at the top-right corner of your screen and select Settings %%LNK1%%.

Once the Settings app is open, follow this path: Power > Power Button Behavior.

Power Button Behavior options
Inside the Power panel, you can choose from several actions for your power button:
- Suspend: Puts your computer into sleep mode.
- Power Off: Shuts down the computer. This is the default setting.
- Nothing: The button will not trigger any action.
- Interactive: This option triggers a pop-up menu asking you what you would like to do.
- Hibernate: This may appear as an option if you have swap space correctly configured on your system.

Your choice is applied immediately. You do not need to restart your computer for these changes to take effect.
Conclusion
Customizing your power button is a simple way to make your PC work the way you want. Whether you want to prevent accidental shutdowns or add a shortcut to sleep mode, these settings give you total control.
Was this guide helpful?
Leave a Reply