Linux: Setup Shift Lock Key

By Xah Lee. Date: . Last updated: .

This page shows you how to setup the Shift or CapsLock 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 CapsLock 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 How-to

  1. Keyboard Software Guide
  2. Swap Control Alt Keys
  3. Set F2 F3 F4 to Cut Copy Paste
  4. CapsLock → Escape
  5. CapsLock → Home
  6. Shift Lock
  7. Key to Switch App
  8. Key Repeat Rate
  9. System Keyboard Layout
  10. Switch Keyboard Layout
  11. Change Volume
  12. xmodmap
  13. xbindkeys
  14. xvkbd
  15. Find Keyboard Key Scancode
  16. X11 Keyboard Key Names
  17. 2 Layouts for 2 Keyboards
  18. Chinese Input Setup


  1. Mouse Hover to Auto-Raise Window
  2. Mouse Hover-Click
  3. Set Mouse Single-Click to Open File
  4. How to Set Mouse Speed
  5. How to Swap Mouse Buttons
  6. Set Trackball/Mouse Do Scroll
  7. Setup Accelerated Scroll and AutoScroll
  8. X11 Mouse Button Numbering

If you have a question, put $5 at patreon and message me.