I want to remap Caps Lock to Esc on my Ubuntu 17.10 laptop.

I have tried this method: How to remap key in Ubuntu 17.10 Wayland? (Up key to Shift), this method: https://linuxcommando.blogspot.ca/2008/03/remap-caps-lock-key-for-virtual-console.html, and this method: https://wiki.archlinux.org/index.php/Xmodmap to no avail.

Neither work, Caps Lock is still Caps Lock.

How do I remap these keys system wide? It's dead simple in OSX, there is a setting in system preferences to make Caps Lock Esc and that's it, it works in every app. Is there anything similar in Ubuntu 17.10?


Same as tranfuria's answer but on command line:

gsettings set org.gnome.desktop.input-sources xkb-options "['caps:escape']"
  • Is there a way to persist this change? It appears to be gone after a system update through apt dist-upgrade. – k0pernikus Sep 3 '18 at 15:58
  • @k0pernikus: It should be persistent. Please ask a new question if you found otherwise. – Gunnar Hjalmarsson Sep 3 '18 at 18:56

You could try the Gnome-tweak-tool, assuming you're running on gnome, if you're on unity, there is a unity-tweak-tool. Both can be installed using apt:

sudo apt-get update


sudo apt-get install gnome-tweak-tool


sudo apt-get install unity-tweak-tool

in the gnome tweak tool under 'Keyboard & Mouse' there is an option called 'Additional Layout' options, in here you can change capslock key behavior, mapping it to esc, as well as just about anything you want.

Here is a picture as to what it might look like Gnome Tweak Tool

  • Great, thank you. I wish there was a way to do it via the command line (I use Ansible to setup new machines), but this is much better than nothing! – springloaded Feb 19 '18 at 23:48
  • @springloaded: Of course there is a command line way to do it too. I showed it in an alternative answer. – Gunnar Hjalmarsson Feb 20 '18 at 15:05
  • 2
    Unfortunately in gnome-tweak-tool 3.28.1 this option is removed. – lz96 May 21 '18 at 5:05
  • @lz96: No it's not. – Gunnar Hjalmarsson Sep 3 '18 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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