You just need to remap keycode 58 from "Caps_Lock" to "Control" then load using loadkeys. Many Linux distros actually have hooks in place to do this for you. This is the command that will do the trick (run this as root):

+

You just need to remap keycode 58 from "Caps_Lock" to "Control" then load using loadkeys. Many Linux distros actually have hooks in place to do this for you. This is the command that will do the trick -- '''if''' you run as root and '''if''' you are at a console.

−

+

<pre>

<pre>

−

dumpkeys | sed 's/58 = Caps_Lock/58 = Control/' | loadkeys

+

dumpkeys | sed 's/\s*58\s*=\s*Caps_Lock/ 58 = Control/' | loadkeys

</pre>

</pre>

+

If you get the following message then it means you didn't run `dumpkeys` as root, '''Couldn't get a file descriptor referring to the console'''.

CapsLock is Satan

How often do you need to type in all caps? The CapsLock key may not the most useless key on the keyboard -- I'd vote for the Print Screen key, but the CapsLock is certainly the most annoying key. Plus it is a big key and in prime real estate. This is a valuable set of attributes that should be reserved for a key that you hit often (Enter, Shift, Control, Delete, etc.).

On most PC keyboards the CapsLock key is where the Ctrl key should be. Whenever I get a new keyboard or laptop, I always pop off the key then take a razor blade and scrape off the "CapsLock" print. I then tweak my operating system so that it thinks this key is a Ctrl key. Some people like to make it an additional Esc key.

Some people believe that IBM took the original computer terminal keyboards and replaced the Ctrl key with the CapsLock key in order to make their first home computer, the IBM PC, appear more familiar to people who were accustomed to typewriters. This is false. In fact, the first IBM PC's had the Ctrl key to the left of the A. Later on, IBM released the IBM PC/AT with a CapsLock favored keyboard. Other people blame Microsoft because they pushed all those other useless keys on the world. There is also a bit of a myth that the old mainframe keyboards were consistent in putting the Ctrl key to the left of the A. Actually, the original PC keyboards were the anomaly. Prior to the PC most printing and display terminals had the CapsLock in the position where it is today. This includes classics such as the DEC VT52 and VT100 terminals; IBM data display terminals such as the IBM2741 and IBM5253. Many of IBM's early small computers that predate the IBM PC had a mix of keyboard styles. Many non-PC personal computers of the time had the CapsLock to the left of the A: TRS-80, BBC Micro, Osborne 1, Commodore Vic-20, and Commodore C=64. The Apple ][ series had the Ctrl key in the proper location to the left of the A key, but sadly, the original Macintosh did not -— it was afflicted with the CapsLock (and this was before the IBM PC/AT went to the Enhanced keyboard). The Atari computers had the proper Ctrl key, but their keyboards were horrible membrane things. The Be BoxOS had CapsLock; Next had Ctrl.

NoCaps!

The follow section explains ways to turn the CapsLock key into something useful. I like to turn it into a Control key, so these examples show that. Other reasonable keys that people redefine CapsLock as are Escape, and Backspace.

Windows

Linux Console

You just need to remap keycode 58 from "Caps_Lock" to "Control" then load using loadkeys. Many Linux distros actually have hooks in place to do this for you. This is the command that will do the trick -- if you run as root and if you are at a console.

dumpkeys | sed 's/\s*58\s*=\s*Caps_Lock/ 58 = Control/' | loadkeys

If you get the following message then it means you didn't run `dumpkeys` as root, Couldn't get a file descriptor referring to the console.

console-tools

This can also be done through console-tools. Edit '/etc/console-tools/remap' and uncomment 'keycode 58'.

X11

When running XWindows you need to modify the X11 key map using xmodmap. It is not sufficient to just modify the console keyboard mapping. Use xmodmap to load the following keymap file (save in ~/.Xmodmap):

make these changes persistent

These keyboard settings are not persistent after a reboot. Most Linuxes will load your ~/.Xmodmap file when you login with xdm or gdm. Some don't. If not then you should add this line to your ~/.xsession and ~/.xinitrc files (after the shebang #!/bin/sh line):

[ -f ~/.Xmodmap ] && xmodmap ~/.Xmodmap

X11 Gnome/Ubuntu

Go to you main panel menu and select the following to get to the CapsLock as Ctrl option: