How to swap ctrl and caps lock using xmodmap

Solution 1:

From Remap Caps Lock :

man xmodmap shows how to swap the left control key and the CapsLock key:

!
! Swap Caps_Lock and Control_L
!
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

Solution 2:

This may work for you.

/usr/bin/setxkbmap -option "ctrl:swapcaps"