Emacs Swap Caps Lock & Control Keys

.xmodmap File

If you use Emacs to do your editing you may find the left control key [Ctrl] is placed badly for regular fast usage. You can switch the control key with the Caps Lock key quite easily in Linux. You need to create a .xmodmap in your home directory. Add the following lines:

!
! Swap Caps_Lock and Ctrl_L
!
remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Contrl_L
add Lock = Caps_Lock
add Control = Control_L

Save the file as .xmodmap and log out your account or restart the x server.

. . .