Monday, March 8, 2010

Disable Caps Lock Key in Linux

I hate the caps lock key. So, in my ~/.bash_profile I have the following line to disable caps lock:
xmodmap -e "remove lock = Caps_Lock"
To turn off caps lock key, enter:
$ xmodmap -e "remove lock = Caps_Lock"
Now caps key is disabled. To enable caps key, enter:
$ xmodmap -e "add lock = Caps_Lock"


  1. Apparently, in Ubuntu 11.04, the proper directions are to click system->keyboard->Layouts->options->caps lock behavio and choose "disable caps lock"

  2. And, now in Ubuntu 12.04, the solution is to make the caps lock another ctrl key like so:
    /usr/bin/setxkbmap -option "ctrl:nocaps"

  3. Another Fun One: Remap caps to f13:
    xmodmap -e 'clear Lock' -e 'keycode 66 = F13'

  4. Terminal option didn't work for me in 12.04, but they seem to have added it into the settings menu, with lots of interesting setup options.

    System settings > Keyboard > Layout settings > Options > Caps lock key behavior.

    I swapped my Caps Lock and Escape keys - should be less likely to hit it by mistake but leaves it on the keyboard if I ever do need Caps lock.