How do I logout using only the keyboard?
Creating custom keyboard shortcuts:
For 12.04 LTS and later:
To add a new shortcut open System Settings -> Keyboard and choose the Shortcuts tab:
Press the '+' sign on the bottom left to enter the name of your custom shortcut and the command you want to run (e.g. gnome-session-quit --logout --no-prompt
). After having applied this you are able to select the line of your new shortcut. Then press the desired key combination. In case the key combination already exist we will have to delete this first.
For 14.04 LTS and later:
In a default Unity session the new logout dialog is presented needing another at least two keystrokes to select poweroff from the menu:
The old dialog with a 60 s timeout will only be displayed in a gnome-flashback session.
In Ubuntu 11.10 you could write a script containing
#/bin/bash
gnome-session-quit --logout --no-prompt
make it executable with chmod +x script-name
, then set a global shortcut to execute this script in Gnome Control Center -> Keyboard.
In previous Ubuntu versions there was gnome-session-save --logout
.
In Ubuntu 1204 there are two out-of-the-box solutions:
"Run a command" technique:
Alt-F2 | type
gnome-session-quit
"Indicator menu" technique:
Alt-F10 | arrow right or left to gear icon | arrow down to
Log Out...
In each case, confirm logout by hitting Enter. A bug in Ubuntu for #1 is that if you login and do nothing and hit Alt-F2 you get Dash (to run programs). Just hit Esc and try again with Alt-F2 and you'll get the "Run a command" instead this time.