computingFreedom | Build | Picolisp | Picolisp Machine | pil sources | Linux | BASH | C Programmming | Operating Systems | Javascipt | Emacs | vim | Pharo Smalltalk | Computer Security | Python | SimpleLinuxConfig | Keyboard Config
Keyboard Config
I usually don’t make too many changes to my keyboards, but swapping the left-control key and caps has become a must. It is very annoying for the first few days, your mind has to physically remap itself to reflect the change. However the long term you won’t regret it.
- This command swaps the left-control into the left caps, your normal left-control still works.
setxkbmap -option ctrl:nocaps - This command swaps the left-control into the left-caps, and left-caps into left control. Im preference
setxkbmap -option ctrl:swapcaps - A simple mnemonic to remember these commands is:
set x keyboard map with -option ctrl: is swap to caps --- - - - --- ------- ------ ---- ---- - I also use the following alias to reset the keyboard if any funny happens:
rsb stands for Reset Key Boardalias rkb="/bin/bash -c 'setxkbmap -layout us -option ctrl:nocaps'" - When things are not going well and you need a full reconfiguration you can use:
dpkg-reconfigure keyboard-configuration
Reading List & Source
The plain idea
This page is about remapping keys in Linux, chiefly the classic move of swapping Caps Lock with Control. On Linux the quick, session-level tool is setxkbmap (under X11), which can turn Caps Lock into another Control key with a single option. It is one of those tiny changes that pays back for years.
Why it matters
Control is one of the most-pressed keys for anyone who lives in Emacs, vim or a shell, and on most keyboards it sits awkwardly in the bottom corner, straining your little finger. Caps Lock, meanwhile, occupies prime home-row real estate and does almost nothing useful. Swapping them is the single best ergonomic tweak for a keyboard-driven workflow.
An everyday analogy
It is like moving the most-used tool in your workshop from a high back shelf to the bench right in front of you, and putting the dust-collecting gadget up on the shelf instead. A few days of reaching to the wrong place, then it feels obvious forever.
A 2026 note
setxkbmap works under X11. If you are on a Wayland desktop (now the default on Ubuntu, Fedora and others), setxkbmap may not apply; use your desktop’s keyboard settings, or a tool like keyd or a localectl XKB option, to make the Caps-to-Ctrl swap. The idea and the key names are identical; only the mechanism differs. For a permanent, display-server-independent remap, keyd is the modern favourite.
A note on the counter-argument
I link “Don’t Swap Ctrl and Caps!” above on purpose. Some people prefer remapping Caps to Escape (handy in vim) or to a dual-role key (Escape when tapped, Control when held). There is no universal right answer; the point is that Caps Lock is wasted space you can reclaim for whatever you press most.
How it connects
The truth revealed: the keyboard is the one tool you touch every single minute at a computer, and spending ten minutes to move your most-used key under a resting finger is among the highest-return tweaks you will ever make.
