Disable and Enable Caps Lock in Ubuntu

Sponsored Link
Solution 1

If you want to disable Caps Lock in Ubuntu you need to type the following command in your terminal

xmodmap -e "clear Lock"

If you want to Enable Caps Lock in Ubuntu you need to type the following command in your terminal

xmodmap -e "add Lock = Caps_Lock"

Solution 2

1) create an appropriate xmodmap-file

xmodmap -pke > ~/.xmodmap.myown

2) Search the line with capslock in it, it's keycode 66 in my case. Replace it with something you wouls like, my line looks like this

keycode 66 = slash backslash

so You need to slash and backslash on your capslock.

3) make two entries for the xmodmap in autostart

xmodmap -e "clear Lock"
xmodmap ~/.xmodmap.myown

with the first command, the capslock function is disabled, with the second the modified keymap is loaded.

You may also like...

19 Responses

  1. Pardon me for asking, but what possible reason could you have for wanting to disable caps lock???

  2. sb says:

    Hey Admin, why not just use the Keyboard control panel? Layout Options -> Ctrl Key Position. Trivial.

    Peter Gasston: Because control is much easier to chord if you move it somewhere where you don’t have to crane your pinky so bad. As it is, the default control position plus emacs is almost a guaranteed recipe for carpal tunnel.

  3. AR says:

    This is very usefull tip. Caps Lock is very annoying button.
    It can also be written without another file:

    xmodmap -e “clear Lock”
    xmodmap -e “keycode 66 = Tab”

    (now caps_lock is tabulator too)

  4. Bannog says:

    In a word: Warcraft. But for the times that I’ve failed to attack something then typed:

    “sORRY PEOPLE MY KEYBOARD ISN’T COOPERATING.”

    AR’s post should eliminate that problem… Will see tonight if ‘t works.

  5. Nero says:

    Jef Raskin in The Humane Interface perfectly stated why the caps lock key should be disabled; it serves almost no function. Few people use it except by accident. Typing in upper-case is generally a temporary mode you want to be in, accomplished by using the shift key. Hitting the caps lock key is almost always a distraction and a loss of productivity. The best purpose the caps lock key can serve is to be mapped to a completely different function.

    One time I thought I had found a use for Caps Lock. Typing an XML file, every character needed to be in uppercase according to our specification, but even that wasn’t good. when I needed to write documentation or switch to other applications like email, I’d always forget that Caps Lock was on. In the end, it was easier to just run my files through a tool that converted to uppercase and forget about Caps Lock forever.

  6. Ben says:

    Thanks for the tip. This is great. I can’t tell you how annoying a find caps lock and insert. The insert key is particularly egregious because I use a small form factor keyboard, and my sausage fingers like to meander down and “press” insert while I am holding shift sometimes.

  7. much simpler method:

    go to system -> preferences -> keyboard
    click the “layouts” tab
    click the “other options” button
    click “ctrl key position”
    click “make capslock an additional ctrl”

    done.

    screenshots:
    step 1
    step 2

  8. Maxoud says:

    A workaround if Capslock still works:
    Copy/Paste does not work for Solution 1:
    When copying from Solution 1 and pasting to Terminal (Console) replace beautiful quotes with straight ones manually.

  9. jim says:

    Hi,

    I have same problem – I would really like to disable insert key. Have tried the following:

    xmodmap -e “keycode 106 = Left”

    but i just get the following errors:

    xmodmap: unknown command on line commandline:1
    xmodmap: unable to open file ’66’ for reading
    xmodmap: unable to open file ‘=’ for reading
    xmodmap: unable to open file ‘Tab”’ for reading
    xmodmap: 4 errors encountered, aborting.

    doesn’t appear to be the same function for insert as there is for ctrl as suggested by Ian Miller above.

    Any ideas?

  10. jim says:

    solved. used xkeycaps program to disable it although this didn’t work in jedit so had a look in jedit’s shortcut options and turned it off it there as well

  11. datakid says:

    I went with AR’s (#3 response); changed it to a Tab key. All good except for “alt tab” for window switching…any ideas people?

  12. Unfortunately, the straightforward approach using gnome-keyboard-properties is currently broken in intrepid: https://bugs.launchpad.net/ubuntu/+source/gnome-control-center/+bug/309434

  13. Thelma says:

    Thankyou thankyou! I have been wondering about this for years. I use a laptop, and love this change. I have never used the capsloack button in my 10 years of computing. However, I have unintentionally activated the stupid thing many hundreds of times. Good work!

  14. Orwellian says:

    You, sir/ma’am, are a genius! Thanks!

  15. blogfeuer.de says:

    nice. nnoooNOw I can FINally ForGETT those TYPINggg ERrrors !!!!!11111

  16. lemon says:

    “Pardon me for asking, but what possible reason could you have for wanting to disable caps lock???”

    Is that a serious question?

    1. It’s a hangover from typewriters.
    2. I’ve never needed it.
    3. It’s ALWAYS switching Itself ON WHEN YOU don’t want it on
    4. There are better uses for a giant key in easy reach.

  17. Wladimir says:

    Thanks, finally a way to disable that annoying toggle button.
    Note: if you simply copy/paste the commands into a terminal it goes wrong, because the ” is a “.

  18. Barry says:

    In Lucid Lynx you can:

    – MENU: System | Preferences | Keyboard
    – TAB: Layout
    – BUTTON: Options
    – EXPAND: CapsLock Key Behaviour
    – SELECT: CapsLock is disabled
    – BUTTON: Close
    – BUTTON: Apply System-Wide

  19. Flimm says:

    Here’s Ian D. Miller’s method, updated for Ubuntu 12.10:

    1. Click on the top-right icon and open “System Settings”.
    2. Open “Keyboard Layout”
    3. Click “Options…”
    4. Expand “Ctrl key position”
    5. Enable “Caps Lock as Ctrl”

Leave a Reply

Your email address will not be published. Required fields are marked *