I'm using Xubuntu 12.04. How do I either swap or remap the Control (or any key) and Caps Lock keys?
4 Answers
Another way:
sudo vi /etc/default/keyboard
then find the line that starts with XKBOPTIONS
, and add ctrl:nocaps
to make Caps Lock an additional Control key or ctrl:swapcaps
to swap Caps Lock and Control.
For example, mine looks like
XKBOPTIONS="lv3:ralt_alt,compose:menu,ctrl:nocaps"
then run
sudo dpkg-reconfigure keyboard-configuration
The reason this way is better is that it will take effect on the virtual consoles (e.g. Ctrl+Alt+F1) as well as in the graphical desktop.

- 6,558
To swap the keys go:
Xubuntu → Settings Manager → Session and Startup
Then in the Sessions and Startup configurator go
Application Autostart (tab at the top) → Add (bottom button)
Now on the Add Application screen
- Name: Control and CapsLk swap
- Description: Swap the two keys
- Command: /usr/bin/setxkbmap -option "ctrl:swapcaps"
To remap Caps Lock to Control go:
Xubuntu → Settings Manager → Session and Startup
Then in the Sessions and Startup configurator go
Application Autostart (tab at the top) → Add (bottom button)
Now on the Add Application screen
Name: Remap CapsLk to Ctrl
Description: Remap the CapsLk key to Control
Command: /usr/bin/setxkbmap -option "ctrl:nocaps"

- 7,526
-
4
-
On my almost fresh Ubuntu 13.10 install, it works when manually executed but not from “Session and Startup”. – Chris Mar 08 '14 at 09:23
-
I no longer suggest this method use the other answer. http://askubuntu.com/a/223674/29097 – Evan Carroll Sep 16 '16 at 22:09
For compose instead of caps put compose:caps
as the -options
parameter.

- 117,780

- 31
For Raring (at least):
Start "Keyboard layout" (from dash).
Press "Options..." to reach "Keyboard layout options" menu.
I chose "Ctrl key position" => "Caps lock as Ctrl". Your tastes may differ.

- 29
- 1
-
2What is "dash"? Surely not Unity (in Xubuntu), I hope. This sounds a lot like the Gnome solution that is unavailable in Xubuntu. – Marty Fried Jun 07 '14 at 23:42
console-setup
package, which seems to have been in Ubuntu since at least Lucid, and probably earlier. – Mikel Jan 22 '14 at 15:22caps:escape
to remap the capslock to esc – Harry Moreno Oct 28 '14 at 06:47sudo dconf write /desktop/ibus/general/use-system-keyboard-layout true
, didn't help. Ended up just making an .Xmodmap. – unhammer Jun 11 '15 at 07:17/usr/share/X11/xkb/rules/xorg.lst
if you're on something like an Ubuntu. – Forbesmyester Sep 02 '16 at 08:58