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.

Incoming search terms:

Related posts

19 thoughts on “Disable and Enable Caps Lock in Ubuntu

  1. 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.

    [Reply]

  2. 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)

    [Reply]

  3. 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.

    [Reply]

  4. 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.

    [Reply]

  5. 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.

    [Reply]

  6. 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

    [Reply]

  7. 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.

    [Reply]

  8. 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?

    [Reply]

  9. 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

    [Reply]

  10. 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!

    [Reply]

  11. “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.

    [Reply]

  12. 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 “.

    [Reply]

  13. 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

    [Reply]

  14. 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”

    [Reply]

Leave a comment

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