Linux
For Linux, keyd is a strong system-wide way to remap Caps Lock into Control or Escape without depending on a specific desktop environment.
Step by step
1. Install keyd
Install keyd first. The source install flow is git clone, make, sudo make install, and sudo systemctl enable --now keyd. If you prefer a tagged version, you can start from the releases page.
Install script
keyd-setup.sh
git clone https://github.com/rvaiya/keyd
cd keyd
make
sudo make install
sudo systemctl enable --now keyd2. Create /etc/keyd/default.conf
Create /etc/keyd/default.conf and start with a simple overload mapping. This setup makes Caps Lock send Escape when tapped and Control when held.
Example config
default.conf
[ids]
*
[main]
# Maps Caps Lock to Escape when tapped and Control when held.
capslock = overload(control, esc)
# Optional: put Caps Lock on Escape too.
esc = capslock3. Reload the daemon
After saving the file, run sudo keyd reload so the new mapping takes effect. If something does not apply cleanly, check the service log with journalctl -eu keyd.
4. Check key names when your keyboard is unusual
If your keyboard layout is unusual or a key name is unclear, use keyd monitor to see the names keyd receives. If you want to check the original device events, stop keyd first and run the command again.
5. Keep the emergency stop sequence in mind
If you make a bad config and need to recover quickly, use Backspace + Escape + Enter to terminate keyd.
Notes
- Treat master as the development branch and tagged releases as the stable option.
- Debian 13+ and Ubuntu 25.04+ also support apt install keyd, but the source install above is the most portable option.
- If you still need Caps Lock sometimes, keep it on another key you rarely use instead of removing it completely.
References