CapsLock Remap Howto
From Noah.org
Jump to navigationJump to searchBasically you need to remap keycode 58 from "Caps_Lock" to "Control" in your keymap file, then load the keymap using loadkeys. The keymap files are stored in different places depending on your version of Linux. Usually I do a locate for "defkeymap".
The keyboard maps in Ubuntu are stored here:
/usr/share/keymaps/i386/qwerty/defkeymap.kmap.gz
On Red Hat Enterprise 4 this file is stored here:
/lib/kbd/keymaps/i386/qwerty/defkeymap.map.gz
The following script takes care of this for Ubuntu Linux:
#!/bin/sh echo "transmogrify the Caps_Lock key into another Control key" gunzip /usr/share/keymaps/i386/qwerty/defkeymap.kmap.gz sed -i -e "s/Caps_Lock/Control/" /usr/share/keymaps/i386/qwerty/defkeymap.kmap gzip /usr/share/keymaps/i386/qwerty/defkeymap.kmap loadkeys -d
These settings are not permanent. I add this to my .bashrc file. This is a bit overkill since it will run this everytime I start a shell.
case "$TERM" in xterm*|rxvt*) # X terminals if [ -f ~/.xmodmap ]; then xmodmap -quiet ~/.xmodmap 2>/dev/null fi ;; *) # console LK=`which loadkeys 2>/dev/null` if [ -x "$$LK" ]; then loadkeys -d fi ;; esac
When running XWindows you need to modify the X11 map using xmodmap. It is not sufficient to just modify the console keyboard mapping. .xmodmap file:
remove Lock = Caps_Lock keycode 0x42 = Control_L add Control = Control_L