after booting into X you can use
xmodmap to remap any key of your keyboard:
just use the command
xmodmap -e 'keycode <value>=<action>'
xev you can get every keycode (and also the used action/keysym)
in your case it would probably be
xmodmap -e 'keycode 66=Escape'.
by the way: if you don't want to type the command every time you login manually, you can insert the line into your .bash_profile and it is executed automatically with your login.
or if you want to remap more than one key you can create a file e.g. ~/.remap and insert something like this:
keycode 8 =
keycode 9 = Escape
keycode 10 = 1 plus plusminus infinity
keycode 11 = 2 quotedbl leftdoublequotemark rightdoublequotemark
keycode 12 = 3 asterisk numbersign leftcaret
keycode 13 = 4 ccedilla Ccedilla slash
keycode 14 = 5 percent bracketleft
keycode 15 = 6 ampersand bracketright
keycode 16 = 7 slash bar backslash
keycode 17 = 8 parenleft braceleft Ograve
keycode 18 = 9 parenright braceright Ocircumflex
keycode 19 = 0 equal notequal Uacute
in this file the keysyms (actions) are separated and the = is surrounded by a space!
within XServer you can use up to 4 keysyms triggered by the following:
- the action by normally pressing the key once
- the action when additionally Shift-Signal (normally Shift_L/Shift_R) is pressed
- the action when additionally Mode_switch-Signal (normally Alt_L/Alt_R) is pressed
- the action when additionally Shift and Mode_switch is pressed
for sure you can also remap Mode_switch with a line like this:
keycode <value> = Mode_switch
and then execute
xmodmap ~/.remap in the terminal or add it to .bash_profile like the upper "one-key-command".