Killing Caps Lock on Ubuntu

  1. Create xmodmap file:

     $ xmodmap -pke > ~/.xmodmap
    
  2. Edit the newly created ~/.xmodmap file, changing the line starting with keycode 66 = to map to a key of your choice. Here's an example where I'm mapping Caps Lock to the Escape key:

     keycode  66 = Escape NoSymbol Escape
    
  3. Load your new map, disabling Caps Lock:

     xmodmap ~/.xmodmap
    
  4. (optionally) You can set this to autostart when you launch Unity by creating the following file:

     $ cat .config/autostart/xmodmap.desktop
     [Desktop Entry]
     Type=Application
     Exec=xmodmap ~/.xmodmap
     Hidden=false
     NoDisplay=false
     X-GNOME-Autostart-enabled=true
     Name[en_US]=xmodmap
     Name=xmodmap
     Comment[en_US]=
     Comment=