Remap Keys in Ubuntu
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:
-
Build a clean Xmodmap config
xmodmap -pke >~/.Xmodmap ```
-
Use xev to see what keycode Caps Lock belongs to (Spoilers: It’s 66 or 0x42).
-
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 ```
-
Reload the keymap
xmodmap ~/.Xmodmap ```
- Done
You now have remapped your Escape down to the Caps Lock. One pinky finger closer to total world domination!
About the author
Brooks Garrett is a dedicated technologist who specializes in information security. Brooks has spent over 10 years implementing security programs for both the public and private sector including some of the biggest names in the Fortune 500. When he's not managing risk in the corporate environment you can find him at the local firestation where he is a volunteer firefighter.