How can I enable Ctrl+Alt+Backspace?
Solution 1:
This was tested on 13.10+, type the following on the terminal:
sudo dpkg-reconfigure keyboard-configuration
You will see the keyboard configuration. Press ENTER 5 times to skip all keyboard related options except for the Kill X part. When you get to the Kill X option which looks like this:
Select YES and press enter. Wait a bit while everything configures and after that you should have the ability to CTRL+ALT+BCKSPC right on the current session. After saving any work you have pending, try it yourself.
Perfect to solve any visual issues or annoying apps.
Thank you @david-c it also looks like this works:
Sudo Edit the /etc/default/keyboard
file and add the line XKBPTIONS="terminate:ctrl_alt_bksp"
to it, so it looks something like this:
Solution 2:
For Unity (13.04 to 17.04):
You want: System->Preferences->Keyboard
Then click the Layouts tab, the Options button, and expand Key sequence to kill the X server, before finally selecting the checkbox.
To enable it via the command line install dontzap
sudo apt-get install dontzap
And in a terminal
sudo dontzap --enable
To disable the shortcut:
sudo dontzap --disable
Solution 3:
You can also use dconf-editor
. This option will make the setting persistent across sessions.
sudo apt-get install dconf-editor
After starting the dconf-editor
, navigate to org >> gnome >> desktop >> input-sources
Add the options that you need in xkb-options
. The option strings are surrounded by single quotes and separated by commas. Be careful not to delete the brackets on the ends.
To enable ctrl+alt+backspace to kill the X-session, add 'terminate:ctrl_alt_bksp'
You can use this method to enter most of the traditional xkb options that are no longer available in System Settings >> Text Entry. The exceptions are the settings for switching the keyboard layouts, which currently do not work because of a bug.
For a list of the options and the syntax, use man 7 xkeyboard-config
in a terminal.
To run the commands equivalent to using dconf-editor
from a terminal, you use
gsettings set org.gnome.desktop.input-sources xkb-options "['terminate:ctrl_alt_bksp']"
Note the single quotes around the value, the square brackets around that, the double quotes around the whole thing. In other words, just like in dconf-editor
.
Note that this will delete your other settings in xkb-options, if you have any.
You can get the existing settings with
gsettings get org.gnome.desktop.input-sources xkb-options
If you don't change these values very often, it might be simplest to combine existing settings with the new one by hand and the run gsettings set
.
It can also be done all at once on the command line. I've put it in a short script here to make it easier to read.
#!/bin/bash
options=$(echo $(gsettings get org.gnome.desktop.input-sources xkb-options)|sed 's/]//g')", 'terminate:ctrl_alt_bksp']"
gsettings set org.gnome.desktop.input-sources xkb-options "$options"
The 2nd line gets the current values and concatenates the terminate...
option. The sed command strips the right square bracket from the current values.
Note that while the argument string to the gsettings get
command in the terminal needs double quotes around the value
"['val', 'val2']"
the argument string when run in a script should not have the double quotes.
['val', 'val2']