Swap esc and caps lock on Ubuntu 11.10


  • caps lock is not very useful
  • caps lock changes the keyboard state, which might be undesirable if you want to use in a keyboard macro program such as Autokey which cannot stop Caps lock from changing state
  • the venerable VIM extensively uses Esc to change modes, so you would rather have it closeby


Append some code to your ~/.Xmodmap file. It’s executed at the right time at startup by the xmodmap command, so that your modifications take place every time.

echo "
! Swap caps lock and escape
remove Lock = Caps_Lock
keysym Escape = Caps_Lock
keysym Caps_Lock = Escape
add Lock = Caps_Lock" >> ~/.Xmodmap


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s