This question already has an answer here:

I have a CentOS server (release 6.7). In order to do tmux shortcuts more quickly (ctrl-b), I thought of mapping the caps lock key as another ctrl key. How do I go about doing this?

I have looked up this up on Google and have tried adding XKBOPTIONS="ctrl:nocaps" to /etc/sysconfig/keyboard to no avail.

marked as duplicate by Gilles, Jeff Schaller, GAD3R, Stephen Harris, Thomas Dickey Sep 6 '16 at 0:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


I've never tried it with CentOS (or any server), but with other systems, I used xmodmap. This probably only works with xwindows running, but I'm not sure.

Using xev, you can find the keyboard codes for various keys. I believe 66 is the caps lock key.

Then, in a terminal, type these lines:

xmodmap -e 'keycode 66 = Control_L'
xmodmap -e 'clear Lock'
xmodmap -e 'add Control = Control_L'

Test it out to see if it works OK, then type:

xmodmap -pke >~/.Xmodmap

Now, any time you type xmodmap .Xmodmap, it will remap the keys. To keep from doing this on every reboot, add a line ~/.xinitrc, like so:

xmodmap .Xmodmap

There is an article on something similar here You can search for "xmodmap" to find more articles.

Not the answer you're looking for? Browse other questions tagged or ask your own question.