How do I switch the Ctrl and CapsLock keys on my keyboard?

Create a file called .xmodmaprc in the root of your home directory.

vi ~/.xmodmaprc

Copy the following lines into the file:

remove Lock = Caps_Lock

remove Control = Control_L

keysym Control_L = Caps_Lock

keysym Caps_Lock = Control_L

add Lock = Caps_Lock

add Control = Control_L

If you are using the bash shell, copy this line into your .bashrc file:

xmodmap .xmodmaprc

The settings will take effect the next time you log out and log back in.