Ubuntu – Shut down computer from keyboard

shortcut-keysshutdownsysrq

Is there a keyboard shortcut available to shutdown the computer?

I know I can use the Power button, but I would like to be able to it from the keyboard.

If such a shortcut does not exist already, how do I set one?

Best Answer

In older versions of Ubuntu Ctrl + Alt + Del will bring up options for shutdown, restart, suspend and hibernate. These can then be selected with the arrow keys and Enter.

For a single hit solution in later versions you can use this script to create a keyboard shortcut. First you need to download the script and save it on your computer. Next you need to make it executable by right clicking on it and going to properties → Permissions → Allow executing file as a program. Finally go to System SettingsKeyboardShortcutsCustom Shortcuts and click the small plus symbol. For the command type in

/home/toby/power.sh shutdown

or whatever path you saved the script to.

Suspend, hibernate and restart are also available by this method; just replace shutdown in the above command.