Code Yarns ‍👨‍💻
Tech Blog ❖ Personal Blog

How to disable caps lock in Linux

📅 2013-May-01 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ caps lock, gnome tweak tool, setxkbmap ⬩ 📚 Archive

The caps lock key is a vestige from older times. It is completely useless today and extremely irritating because it gets turned on by mistake while using programs like Vim. It is a good idea to turn it off completely by disabling it.

The setxkbmap program can be used to disable caps lock completely in all desktop environments and window managers by mapping it to the Ctrl key:

$ /usr/bin/setxkbmap -option '' -option 'ctrl:nocaps'

To apply this setting every time you login to any desktop environment, add the above line to your ~/.profile file. Log out and login to see the effect of this option.

Other methods to disable caps lock that I used to try earlier are given below:


Ubuntu 14.04

Install the GNOME Tweak Tool:

$ sudo apt-get install gnome-tweak-tool

Open it by typing Tweak Tool in the Dash. Choose Typing → Caps Lock key behavior. Confusingly, it is shown as Disabled. But this means that any customization on that is disabled. In the dropdown choose Caps Lock is disabled option and you are done!

Ubuntu 12.04

Open Keyboard Layout and click on the keyboard layout you are using, for example English (US). Click on Options → Caps Lock key behavior and choose Caps Lock is disabled.

© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 • 📧