Linux: Setup Shift Lock Key

By Xah Lee. Date: . Last updated: .

This page shows you how to setup the Shift or Caps Lock keys do shift-lock.

Shift-lock means you don't have to hold the Shift key. For example, to enter T, press the Shift key, release, then press t.

How to Make CapsLock Do Shift-Lock

To make Caps Lock do shift-lock, run this in terminal:

# linux, set capslock as shift lock
setxkbmap -option caps:shiftlock

How to Make Shift Do Shift-Lock

Create a file at ~/.Xmodmap. The file content should be this:

! -*- coding: utf-8 -*-
! 2017-01-14

! make capslock and shift keys do shift lock

! here's the default setting on special keys
! xmodmap -pke | grep -iP '(shift|caps)'
! keycode  50 = Shift_L NoSymbol Shift_L
! keycode  62 = Shift_R NoSymbol Shift_R
! keycode  66 = Caps_Lock NoSymbol Caps_Lock
! keycode  92 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift

! make capslock do shift lock
xmodmap -e "keycode 66 = Shift_Lock"

! make the left Shift key do shift lock
xmodmap -e "keycode 50 = Shift_Lock"

! make the right Shift key do shift lock
xmodmap -e "keycode 62 = Shift_Lock"

Now, run this line in terminal:

xmodmap ~/.Xmodmap

That's it.

When X11 starts, that file will be loaded automatically.

See also: Ban Shift Key

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: xvkbd tutorial
  15. Linux: Find Keyboard Key Scancode
  16. Linux: X11 Keyboard Key Names