Ubuntu Linux

Change Power Button Behavior in Ubuntu Linux

Richard
Written by
Richard
Oct 16, 2022 Updated Apr 15, 2026 2 min read
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%%.

Ubuntu Linux activities overview screen for settings

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

Ubuntu Linux system menu showing settings option

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

Ubuntu Linux power tile in system settings

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.

Ubuntu Linux power button behavior selection options

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?

Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, the owner and lead writer at Geek Rewind, is a tech enthusiast passionate about simplifying complex IT topics. His years of hands-on experience in system administration and enterprise IT operations have honed his ability to provide practical insights and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

2458 articles → Twitter

📚 Related Tutorials

How to Change What the Power Button Does in Windows 11
Windows How to Change What the Power Button Does in Windows 11
How to Change Power Button Actions on Windows 11
Windows How to Change Power Button Actions on Windows 11
Enable Mobile Hotspot on Ubuntu Linux
Ubuntu Linux Enable Mobile Hotspot on Ubuntu Linux
How to Uninstall Software in Ubuntu Linux
Ubuntu Linux How to Uninstall Software in Ubuntu Linux

Leave a Reply

Your email address will not be published. Required fields are marked *