· technology howto linux

Remap Keys in Ubuntu

A Keyboard

I’m following along Daniel Miessler’s Vim Primer and saw he remapped the Caps Lock key to be his Control key. I thought this was an interesting concept but I’d rather have Escape on my Caps Lock. Also, I’m running Ubuntu instead of OSX. Off to the interwebs!

A short bit of Google-fu brough me to a couple of resources which answered the question for me. Combining the information I found led me to this process for remapping the keys:

  1. Build a clean Xmodmap config

xmodmap -pke >~/.Xmodmap ```

  1. Use xev to see what keycode Caps Lock belongs to (Spoilers: It’s 66 or 0x42).

  2. Edit the Xmodmap config to remap the Caps Lock Key by editing the following lines:

clear lock … A bunch of other keycodes … keycode 66 = Escape ```

  1. Reload the keymap

xmodmap ~/.Xmodmap ```

  1. Done

You now have remapped your Escape down to the Caps Lock. One pinky finger closer to total world domination!

  • LinkedIn
  • Tumblr
  • Reddit
  • Google+
  • Pinterest
  • Pocket