sudo vi /etc/default/keyboard
then find the line that starts with XKBOPTIONS, and add ctrl:nocaps to make Caps Lock an additional Control key 将 Caps Lock键当作额外的Ctrl键
or ctrl:swapcaps to swap Caps Lock and Control.将Ctrl和CapsLock键替换
For example,
someone looks like
XKBOPTIONS="ctrl:nocaps"
mine looks like
XKBOPTIONS="lv3:ralt_alt,compose:menu,ctrl:nocaps"
then reboot
or run
sudo dpkg-reconfigure keyboard-configuration
The reason this way is better is that it will take effect on the virtual consoles (e.g. Ctrl+Alt+F1) as well as in the graphical desktop.