How to remap caps-lock to escape


Create a file at ~/.xmodmap with the following content:

! -*- coding: utf-8 -*-
! 2014-09-10
! make caps lock do escape
! from http://xahlee.info/

! keycode   9 = Escape NoSymbol Escape
! keycode  66 = Caps_Lock NoSymbol Caps_Lock

clear Lock
keycode 66 = Escape NoSymbol Escape
Now, run this line in terminal:

xmodmap ~/.xmodmap


 _    _    __    __    __  
 | |  | |  |  |  |  \  /   |  |
 | |  / |  |  |  | \ \/ /  |  |
  \ \/ /   |  |  | |\__/| |  |
   \__/    |__|  |_|    |_|