73

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?

1
  • 1
    For some reason many things are changed in 12.04, and most answer will not work.
    – umpirsky
    Aug 27, 2012 at 9:26

19 Answers 19

34

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.

3
  • This does not work in Ubuntu 11.10. Now it offers just log out button.
    – umpirsky
    Nov 1, 2011 at 9:18
  • 4
    ctrl-alt-delete doesn't work in 14.04 either: bugs.launchpad.net/ubuntu/+source/unity/+bug/1403289 Dec 17, 2014 at 4:10
  • In Ubuntu 18.04 bionic I added a custom shortcut as described but the command "gnome-session-quit --power-off" which gives you quick access to reboot/shutdown, picked Ctrl+Alt+Ins as combo .. close but no cigar kind of humor ;-)
    – flowtron
    Feb 25, 2019 at 15:14
33

There are some low level keyboard shortcuts available. They talk directly to the kernel and can break things. You probably shouldn't use these. But in the interest of counter-acting the atrocious answers recommending this method, here's how to use the SysReq button to shutdown or reboot your system. If your cpu bursts into flames because of these incantations, well, can't say I didn't warn you.

Graceful

Reboot

There is a mnemonic here: busier backwards. As in, you are too busy to shutdown properly, so you are doing it backwards.

alt + SysRq + r , e , i , s , u , b

I borrowed this from wikipedia*:

unRaw      (take control of keyboard back from X),
 tErminate (send SIGTERM to all processes, allowing them to terminate gracefully),
 kIll      (send SIGKILL to all processes, forcing them to terminate immediately),
  Sync     (flush data to disk),
  Unmount  (remount all filesystems read-only),
reBoot     (durr)

Shutdown

This is the same except at the end use o for Off instead of b for reBoot.

alt + SysRq + r , e , i , s , u , o

Destructive

This is like yanking the power cord out. You risk destroying recently saved data (files not quite actually written to disk) and you will definitely lose anything unsaved. On the upside, it is quick and to the point.

reBoot: alt + SysRq + b

shut Off: alt + SysRq + o

Use in graphical desktop environment

Under graphical environments like Unity, alt + SysRq takes a screenshot. You must hold down ctrl as well.

Thank you wikipedia for the information in this post.

0
31

11.10 and later

Pressing Ctrl+Alt+Del leads to the logout dialog. If you need the old functionality back you will have to define your own shortcut by opening Keyboard -> Shortcuts from System settings and add this command:

gnome-session-quit --power-off

enter image description here

Alternatively we can use a shoutdown only dialog as shown in this answer

/usr/lib/indicator-session/gtk-logout-helper --shutdown

enter image description here

Note

Before we can use Ctrl+Alt+Del we will have to assign another shortcut to logout.


11.04 and earlier

Using default keyboard settings pressing Ctrl+Alt+Del will open the following window:

enter image description here

The first entry is selected by default for an immediate shutdown by just pressing Return in addition.

There also is a countdown that shuts down your system after 60s without any further keyboard action.

6
  • 1
    You know what is weird? When you hit Ctrl+Alt+Del dialog that pops up does not get focus :) Thanks.
    – umpirsky
    Jul 16, 2011 at 8:35
  • 2
    uh - that's weird indeed, as it does get focus on my system here. You could leave it to shut down after the countdown however.
    – Takkat
    Jul 16, 2011 at 10:08
  • This does not work in Ubuntu 11.10. Now it offers just log out button.
    – umpirsky
    Dec 28, 2011 at 7:49
  • Thanks. I have problems disabling existing shortcut (System > Log out). + and - buttons are disabled, Backspace does nothing and I can't edit it.
    – umpirsky
    Dec 28, 2011 at 8:55
  • That's what I tried, but when I try to assign shortcut Ctl + Alt + Del logout window pops up, that's why I try to remove it in the first place :) When I try some other shortcut, it does not work as well, it just stays disabled.
    – umpirsky
    Dec 28, 2011 at 11:05
29

Well, an easy one to try is to open the keyboard shortcuts.

If using Unity, press the window key/superkey and then type shor and select keyboard shortcuts. Here you can then create a new shortcut and then assign a key combo to shut your pc down… without using your power button!

The command for your shortcut should be:

/usr/lib/indicator-session/gtk-logout-helper -s

Which will shut you down!!

Here is mine which I did to test it:

Shut down!

2
  • 2
    this one's better Apr 26, 2013 at 9:33
  • I can't find this command on Ubuntu 15.10. For an alternative command that lets you shutdown, suspend, logout, etc, see my answer very far down this page. Search page for 'systemctl' Apr 15, 2016 at 18:29
13

You could also launch a Terminal window with Ctrl+Alt+T and then type sudo halt.

2
  • 4
    This is not a keyboard shortcut.
    – N.N.
    Jul 15, 2011 at 22:10
  • 10
    It does not require a Mouse to do it. Also, sudo shutdown now works too. Use the -rflag to restart, instead. Jul 16, 2011 at 2:51
11

It's not a real shortcut, but an interesting way to do it from the keyboard:

  • Alt+F10 > Left > Up > Enter
2
  • Hallelujah! Press Enter again at the shutdown dialog to do the shutdown. Works because: Alt-F10 takes you to the menu, left wraps around to the right, up wraps around to the bottom, enter to do "Shutdown" menu item, Enter again to click the click the shutdown icon button (or left arrow, Enter, to restart instead).
    – robocat
    Apr 19, 2015 at 1:02
  • @PeterMortensen Now is Super+F10 > arrow keys > Enter Sep 14, 2020 at 0:24
2

After install Gnomenu, I found out another simple way to shutdown the computer immediately without choosing any option. Just add this python -u /usr/lib/gnomenu/session-manager.py shutdown to keyboard shortcut with your favorite shortcut to shutdown computer. I myself use Super+F4. Hope this help :D

2

If you are using an ubuntu version prior to 11.04, the easiest way I have found to shutdown the computer via keyboard is to type: Super + S, Up, Enter

You will be offered a prompt that asks for verification that you want to shutdown. But you can eliminate this prompt by making a configuration change in the gconf-editor. Then the shortcut I posted above will directly and quickly shutdown the computer without prompt.

2

This is a good way:

  • Press the Super key (also called the "Windows key").
  • Press L twice. This brings you to the login screen.
  • Press Tab.
  • Press Enter.
  • Press the right arrow key.
  • Press Enter.
0
2

For KDE / Kubuntu

  • Shutdown: Ctrl+Alt+Shift+PgDown
  • Reboot: Ctrl+Alt+Shift+PgUp
  • Log out: Ctrl+Alt+Shift+Del

Confirmed to work in Kubuntu 12.04 and 12.10.

enter image description here

Or in Energy Saving settings, set the power button on your PC to do this:

enter image description here

1
  1. Open the terminal by pressing Ctrl + Alt + T
  2. Type the below command

    sudo poweroff

  3. Press enter
1
  • 1
    Wouldn't this require a password. If so, this would defeat convenience. Dec 17, 2014 at 4:16
1

On Unity (until Ubuntu 17.04)

In 12.10 (don't know about lower versions) it is possible to do the following:

  • Minimise all windows using Ctrl + Super + D
  • Tap Alt to bring up the HUD
  • Type as many letters of "Shut Down" as required for the auto-completion to select the Shut Down command
  • Hit Enter once to bring up the Shut Down dialog, twice to shut down
0
1

On GNOME 3 (17.10 and above)

Some other alternatives are:

  • With run command prompt shortcut: Alt + F2, type "power off".

    screenshot

    Which will run gnome-session-quit --power-off.

  • From top bar: Ctrl + Alt [+ Shift] + TAB (switch Windows/Top bar system controls)
    or Super + M (notification menu)
    or Super + F10 (application menu)
    move with arrow keys to the traditional shutdown option.

It seems there is no east/straightforward way like on other platforms

0

If your GUI ubuntu desktop is not freezed, open a terminal by Ctrl+Alt+T shortcut and do the following:

To shutdown now :

sudo shutdown -P now

To restart now :

sudo shutdown -P -r now

To shutdown after (say) 20 minutes :

sudo shutdown -P 20  

Similarly, for restart also replace now by 20.

(To stop timed execution: Say after 15 minutes you decide not needed to shutdown/restart then go to the terminal window in which you executed the command and press Ctrl+C.)


If your GUI ubuntu desktop is freezed, go to commandline ubuntu desktop by Ctrl+Alt+F1(Here in place of F1, the keys F1to F6 are applicable ; also Ctrl+Alt+F7 will give you the GUI desktop back). Now in commandline ubuntu enter your login username and password. After successful login execute the same commands described above for shutdown (or restart).

0

On Ubuntu 15.10, I have defined a custom keyboard shortcut that runs the following command:

systemctl poweroff

This will not work on older versions of Ubuntu, although I don't know exactly when it started working.

systemctl accepts other commands:

halt            Shut down and halt the system
poweroff        Shut down and power-off the system
reboot [ARG]    Shut down and reboot the system
suspend         Suspend the system
hibernate       Hibernate the system
hybrid-sleep    Hibernate and suspend the system

Plus about two dozen others.

1
  • 2
    It probably started working when systemd became init, which would be in 15.04.
    – muru
    Apr 15, 2016 at 18:24
-1

Best is Ctrl+Alt+Del as many have said. That's the best way (especially for non-advanced users). If you wanna do it more 'geekily',then try opening a terminal and typing in the command (halt I think it was).

[ If the system is not responding, you can do Ctrl+Alt+Backspace which will forcefully log out of the system. (It won't shut down, just log off). I believe it's a safer alternative to the 'SysResq' key combo. ]

2
  • 3
    C+A+Bksp will shut down the X server (not enabled by default in new Ubuntu installs, you need to enable this in Keyboard options), bringing you back to GDM (user login); if you have graphical login, this will indeed log you out - in a rather forceful way. You are correct that this is somewhat safer than messing with SysRq, but it's still an emergency option at best. Jul 20, 2011 at 11:28
  • 1
    To succeed, the halt command must be run as root (so run sudo halt instead of just halt). Also, by default, Ctrl+Alt+Backspace doesn't actually do anything on an Ubuntu system. You can use Alt+SysRq+K instead, or you can re-enabled it by editing a configuration files. Details here. Aug 4, 2012 at 19:10
-2

I believe that there's some sysRequest short cut but I know of only two... They're useful to me so if you want to reboot hit sysRequest+alt then type REUSB if you want to shut down always sysRequest+alt and type RSEOUI
Hope that will help ;]

2
  • 3
    You seem to be offering a cargo-cult incantation ("this is magic - it works, but I have no idea how"): unRaw, tErminate, Unmount, Sync, reBoot? If you've umounted the disks for writing, what is the point of syncing? (Hint: none) Also, RSEOUI is unRaw,Sync,tErminate,shut Off,Unmount,kIll - wtf? You're sending the last two commands to a computer that's turned off; also, the sync is pointless as E will trigger a graceful exit - more disk writes. For more info, see this: en.wikipedia.org/wiki/Magic_SysRq_key#Magic_commands Please don't give advice without knowing what it does. Jul 20, 2011 at 11:19
  • 2
    (Yes, your SysRq incantation will work - but somewhat accidentally. Note also that this is not a very clean way of initiating a shutdown.) Jul 20, 2011 at 11:21
-2

Try the combination of Ctrl+Alt+Shift+Del

1
  • 1
    For my 12.04 system that is logging out instead of shutting down.
    – gertvdijk
    Jul 20, 2013 at 12:15
-3

The fastest and most reliable thing is Ctrl+Alt+SysRq+o It's a direct command to the kernel

3
  • 8
    Congratulations, you have directly shut off your system without any sort of cleanup - anything that's still in write caches will be lost, and non-journalled filesystems may get corrupt; that's not to mention any network connections. Your answer is technically correct - this will indeed reliably shut down the computer, but you may want to disconnect the hardware electrical plug instead - that's even more reliable, and has the same effect. Jul 20, 2011 at 11:25
  • @Piskvor While you're right that this is not a good way to shut down your computer, it is a little better than pulling the plug. The computer shuts itself off with this method. In particular, hard drives' read/write heads are unlikely to crash down onto the platters and physically damage the drive. But if the computer is not responding at all and must be force shut down (rather than restarted with Alt+SysRq+REISUB), Alt + SysRq + R E I S U O should be used (see this article). Aug 4, 2012 at 19:14
  • 1
    @Eliah Kagan: Oh, anything more sophisticated than physically cutting the power is (even if negligibly) better - and the "raising elephants" sequence which you mention is the accepted way of doing this - but still, the SysRq commands are an emergency, last-resort measure, to be used when everything else fails. (As for physical damage, any hard drives recent enough to be still operational - i.e. approximately 15 years old or newer - will automatically park themselves on power loss, so the risk of physical damage is very theoretical.) Aug 6, 2012 at 9:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.