The very concept of the Caps Lock key is aggravating to me. Obviously such a useless function should not have its own key and certainly not a key so easy to type. Once you get used to having a control key just to the left of the "A", your arthritis will be cured, you’ll be able to bowl a perfect game, your life will be a joyous celebration, and you will no longer be able to use uncorrected keyboards.

This Emacs wiki page is an unusually competent resource on the topic of fixing the Caps Lock menace. Of course Emacs would really be especially awful with the Control key in the wrong place.


Consoles are the seriously text only screens that you can often get to (under Linux) with something like [C][A]-F2. ([C][A]-F7 or [C][A]-F1 usually brings you back to your graphical session). These can be very useful for troubleshooting broken graphics drivers or for using the computer at all if it is a non-graphical server whose network is down.

Unfortunately the GUI settings menus of various window managers (Gnome, KDE, et al) tend to not touch the console settings at all. The way to really deeply cure caplockitis on the consoles is to edit the keyboard mappings.

vi /usr/share/keymaps/i386/qwerty/

Change keycode 58 from "Caps_Lock" to "Control".

Make this take effect.

loadkeys us

Ah, that’s better.

Also for the console fix in Gentoo, you might be able to get away with editing /etc/conf.d/keymaps and adding KEYMAP="emacs" and then /etc/init.d/keymaps restart.

Debian Consoles

Go to System→Preferences→Keyboard→Layouts→Options→Ctrl key position Check "Caps Lock as Ctrl".

Amazingly the virtual console can also be cured with minimal fuss.

sudo sed -i 's@\(XKBOPTIONS="\)@\1ctrl:nocaps@' /etc/default/keyboard
sudo dpkg-reconfigure -phigh console-setup

Takes effect after the next reboot.

Raspberry Pi

This is especially frustrating for me because I need to rely more heavily on my keyboard shortcuts because of interface sluggishness. And the default keyboard configuration on Raspbian GNU/Linux 9 (stretch) doesn’t include this setting. There seems to be a couple of methods to cure the problem and they seem to work for people randomly.

Trying again on Raspbian 10, just adding ctrl:nocaps to /etc/default/keyboard on the XKBOPTIONS line seemed to work fine for the GUI.

The one that worked for me in the aforementioned system is the exact process described above for general consoles. Doing both steps also cured the GUI (not necessarily in that order).

Other people believe that you need to put this in ~/.config/lxkeymap.cfg.

option = ctrl:swapcaps

That did not work for me.

Some people need to resort to xmodmap which can apparently be installed with package x11-xserver-utils.

General X Windows Systems

In graphical environments, it used to be something like editing /etc/X11/xorg.conf and adding a Option "XkbOptions" "ctrl:nocaps" line. But this is not likely to work reliably today. Now there are all kinds of approaches but the one that seems to still do anything is setxkbmap.

You can check how things are set up using setxkbmap -print and looking at the xkb_symbols field.

To actually try to change the Caps Lock to a Control do something like this.

setxkbmap -option -option 'ctrl:nocaps'

Note that specifying the -option (single dash long option… ahem) twice is necessary because if there is some other messy setting in there, it appends the new one by default without the argumentless option first.

setxkbmap -option 'caps:ctrl_modifier'


Why this is so absurdly complex is hinted at in this 2013 comment by Bogdan in the link I provided above. I’ll quote the whole thing because it’s so interesting.

On a modern Linux like Ubuntu Precise it is actually /usr/share/X11/xkb/rules/evdev.lst that’s being used by setxkbmap. base.lst is another one of these paste-and-rape decoy files.

I should also point out that ‘setxkbmap […] -print’ creates stanzas ready for feeding to xkbcomp, and for me these stanzas were not harder to understand than setxkbmap command line options. I ended up not using setxkbmap at all because it seemed like obfuscation rather than abstraction in the end, and came to the same conclusion.

I think the main virtue of this setxkbmap spaghetti is the evdev.xml file which was probably meant for some GUI keyboard configurator wallpaper to parse, but I’m being speculative. Anyway I think humans should create an example stanza with ‘setxkbmap […sane options…] -print’, edit that file, and invoke ‘xkbcomp $DISPLAY’ from xinitrc or Xsession or .config/autostart or whatever you use to twiddle new sessions.

Note the link he cites as it is truly a revelation and worth a read to the serious capslock hater.


Another classic Unix way is the xmodmap utility. Add xmodmap .xmodmaprc-ibmpc to ~/.xsession or maybe in something in /etc/X11/Xsession.d/.

Here is JM’s very wholesome Unix way of solving the problem. Note this shows some other changes in addition to the caps lock which might be helpful on laptops with irritating layouts. Or if you just like your escape key next to the 1 as it was on some classic keyboard layouts.

! `xmodmap' input file for an IBM PC style keyboard

remove lock =           Caps_Lock
remove control =        Control_L

! Swap the Caps Lock key with the left CTRL key.
keysym Control_L =      Caps_Lock
keysym Caps_Lock =      Control_L

! Change the key to the left of the "1" key to send an escape character.
keysym grave =          Escape
! Undefine the original escape key.
keysym Escape =
! For lack of a better place, put grave/tilde here.
keysym Delete =         grave asciitilde

add lock =              Caps_Lock
add control =           Control_L


In Gnome situations, there are often cryptic poorly organized hidden settings to fix caps locks. Looks like in Gnome 3 they removed all useful functionality including the ability to get rid of the capslock function in an obvious way. I found that the setxkbmap was my only recourse (any behind the scenes technique will probably work).

It looks like the generally accepted technique when confronted with a gloopy stock Ubuntu mess is to install the package gnome-tweak-tool. Then run that (same name as package) and select "Typing" towards the bottom left. Then look for "Caps Lock key behavior". Select "Make Caps Lock an additional Ctrl". All good.

Here you can find some images of the correct menus which will help you find these sneaky settings.


Go to System PreferencesKeyboard and choose Modifier Keys. Select the "Caps Lock" labeled selection box and choose "Control". Bravo to Mac for having a system here that is in no way nonsensical (except for having the Caps Lock to begin with).

Other Keyboard Tricks

Maybe you have some offensive logos on some keys on your computer that you have scraped off and are now wondering what to do with them. Maybe you even have an odd keyboard with a "Win-Lock" lit key. What is that? Well, the way to find out is with xev.

Mouse Issues

This is a little off topic but mice often have similar problems as capslock, basically having your IO devices not behave intelligently.

Middle Mouse Button

A common problem is how to make a two button trackball produce a middle click?

xinput list
xinput list-props $DEV_ID

Look for this.

Evdev Middle Button Emulation (276):    1

If the property is not active (i.e. "1"), set it.

xinput --set-prop $DEV_ID "Evdev Middle Button Emulation" 1

When active, both buttons together send the middle button event. I notice this can even be active when there is a middle button. This can be useful for pasting without scrolling if the middle button is also the scroll wheel.

Mouse Sensitivity

Here’s how to adjust the mouse sensitivity.

xinput set-prop $DEV_ID "Device Accel Constant Deceleration" 2


Ick, right? Well, it can be cured even in this wasteland. This website has a solution that did work for me in Windows 10. It involves downloading a simple registry edit but you can read it and see that it’s probably not doing too much nefarious stuff. (This platform is not my specialty so don’t bet your life on that.) The file I used is shown here for reference.

$ xxd /tmp/caps_lock_to_control.reg
00000000: fffe 5700 6900 6e00 6400 6f00 7700 7300  ..W.i.n.d.o.w.s.
00000010: 2000 5200 6500 6700 6900 7300 7400 7200   .R.e.g.i.s.t.r.
00000020: 7900 2000 4500 6400 6900 7400 6f00 7200  y. .E.d.i.t.o.r.
00000030: 2000 5600 6500 7200 7300 6900 6f00 6e00   .V.e.r.s.i.o.n.
00000040: 2000 3500 2e00 3000 3000 0d00 0a00 0d00   .5...0.0.......
00000050: 0a00 5b00 4800 4b00 4500 5900 5f00 4c00  ..[.H.K.E.Y._.L.
00000060: 4f00 4300 4100 4c00 5f00 4d00 4100 4300  O.C.A.L._.M.A.C.
00000070: 4800 4900 4e00 4500 5c00 5300 5900 5300  H.I.N.E.\.S.Y.S.
00000080: 5400 4500 4d00 5c00 4300 7500 7200 7200  T.E.M.\.C.u.r.r.
00000090: 6500 6e00 7400 4300 6f00 6e00 7400 7200  e.n.t.C.o.n.t.r.
000000a0: 6f00 6c00 5300 6500 7400 5c00 4300 6f00  o.l.S.e.t.\.C.o.
000000b0: 6e00 7400 7200 6f00 6c00 5c00 4b00 6500  n.t.r.o.l.\.K.e.
000000c0: 7900 6200 6f00 6100 7200 6400 2000 4c00  y.b.o.a.r.d. .L.
000000d0: 6100 7900 6f00 7500 7400 5d00 0d00 0a00  a.y.o.u.t.].....
000000e0: 2200 5300 6300 6100 6e00 6300 6f00 6400  ".S.c.a.n.c.o.d.
000000f0: 6500 2000 4d00 6100 7000 2200 3d00 6800  e. .M.a.p.".=.h.
00000100: 6500 7800 3a00 3000 3000 2c00 3000 3000  e.x.:.0.0.,.0.0.
00000110: 2c00 3000 3000 2c00 3000 3000 2c00 3000  ,.0.0.,.0.0.,.0.
00000120: 3000 2c00 3000 3000 2c00 3000 3000 2c00  0.,.0.0.,.0.0.,.
00000130: 3000 3000 2c00 3000 3200 2c00 3000 3000  0.0.,.0.2.,.0.0.
00000140: 2c00 3000 3000 2c00 3000 3000 2c00 3100  ,.0.0.,.0.0.,.1.
00000150: 6400 2c00 3000 3000 2c00 3300 6100 2c00  d.,.0.0.,.3.a.,.
00000160: 3000 3000 2c00 3000 3000 2c00 3000 3000  0.0.,.0.0.,.0.0.
00000170: 2c00 3000 3000 2c00 3000 3000 2000       ,.0.0.,.0.0. .
$ md5sum /tmp/caps_lock_to_control.reg
99ca68956e84d452b0af46f873e4beeb  /tmp/caps_lock_to_control.reg

Strange format, but hey, I’m no expert. Here is the hot link to the file I used. Just acquire this file, double click it, agree to the madness, reboot (natch), and make the most of it.