Linux: Swap CapsLock Escape Keys

By Xah Lee. Date: . Last updated: .

How to make Caps Lock do Esc Key on Linux?

Create a file at ~/.Xmodmap with the following content:

! -*- coding: utf-8 -*-
! 2014-09-10
! make caps lock do escape
! Linux: Swap CapsLock Escape Keys

! keycode   9 = Escape NoSymbol Escape
! keycode  66 = Caps_Lock NoSymbol Caps_Lock

clear Lock
keycode 66 = Escape NoSymbol Escape

Now, run this line in terminal:

xmodmap ~/.Xmodmap

When you restart, that file will run automatically.

back to Linux: xmodmap Tutorial

Linux Keybinding Topic

  1. Linux: Keyboard Software Guide
  2. Linux: Swap Control Alt Keys, xmodmap
  3. Linux: Set F2 F3 F4 to Cut Copy Paste
  4. Linux: Swap CapsLock Escape Keys
  5. Linux: Make CapsLock Do Home Key
  6. Linux: Setup Shift Lock Key
  7. Linux: Add Keyboard Shortcut to Switch App
  8. Linux: Set Key Repeat Rate
  9. Linux: Set System Keyboard Layout
  10. Linux: How to Switch to Dvorak Keyboard Layout
  11. Linux: Change Volume by Command
  12. Linux: xmodmap Tutorial
  13. Linux: Xbindkeys Tutorial
  14. Linux: Find Keyboard Key Scancode
  15. Linux: X11 Keyboard Key Names