put this in your .bashrc:

xmodmap <(echo -e "keycode 110 = Caps_Lock\nkeycode 66 = Escape\nclear Lock\nadd Lock = Caps_Lock")