Disable Caps Lock Key in Linux

Q. How do I deactivate caps lock key in Linux permanently?



A. You need to use the xmodmap command. It is used to edit and display the keyboard modifier map and keymap table that are used by client applications to convert event keycodes into keysyms. It is usually run from the user’s session startup script to configure the keyboard according to personal tastes.

ADVERTISEMENTS



You can also use the setxkbmap command, which maps the keyboard to use the layout determined by the options specified on the command line.

xmodmap command to turn off caps key

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"

Add following code to your shell startup file ~/.bash_profile or ~/.profile file:

$ echo 'xmodmap -e "remove lock = Caps_Lock"' >> ~/.bash_profile

setxkbmap command to turn off caps locks key

To turn off caps lock key, enter:

$ setxkbmap -option ctrl:nocaps

To reset caps lock. enter:

$ setxkbmap -option

Further readings: