Q. How do I deactivate caps lock key in Linux permanently?
A. You need to use the xmodmap command. It is used to edit and display the keyboard modifier map and keymap table that are used by client applications to convert event keycodes into keysyms. It is usually run from the user’s session startup script to configure the keyboard according to personal tastes.
You can also use the setxkbmap command, which maps the keyboard to use the layout determined by the options specified on the command line.
xmodmap command to turn off caps key
To turn off caps lock key, enter:
$ xmodmap -e "remove lock = Caps_Lock"
Now caps key is disabled. To enable caps key, enter:
$ xmodmap -e "add lock = Caps_Lock"
Add following code to your shell startup file ~/.bash_profile or ~/.profile file:
$ echo 'xmodmap -e "remove lock = Caps_Lock"' >> ~/.bash_profile
setxkbmap command to turn off caps locks key
To turn off caps lock key, enter:
$ setxkbmap -option ctrl:nocaps
To reset caps lock. enter:
$ setxkbmap -option
Further readings:
- setxkbmap and xmodmap commands man pages
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop
/ul>
You should follow me on twitter here or grab rss feed to keep track of new changes.













{ 8 comments… read them below or add one }
I have switched ESC and CAPS_LOCK, which makes vim much easier to use.
Making caps lock an additional control key is ver useful also. It makes typing shortcuts a lot easier.
I want to disable a bunch of keys because my daughter accidently presses them when she is playing a game on her “Aspire one”. The method worked for many keys but not all.
For example to disable the tux-key (the linux equivilent to the windows-key)
xev doesn’t show a keycode when i press the tux key
infact i don’t see any Keypress event, just a lot of other events.
———————————————————————————
[user@localhost ~]$ xmodmap -pm
xmodmap: up to 3 keys per modifier, (keycodes in parentheses):
shift Shift_L (0×32), Shift_R (0x3e)
lock Caps_Lock (0×42)
control Control_L (0×25), Control_R (0x6d)
mod1 Alt_L (0×40), Meta_L (0x9c)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0x7f), Hyper_L (0×80)
mod5 Mode_switch (0x5d), ISO_Level3_Shift (0×71), ISO_Level3_Shift (0x7c)
———————————————————————————————
I thought it might be possible to just remove the mapping for “mod4 Super_L”, but even that did not work.
Any tips on this, most welcome.
//The Lowley Worm
I think, that the command
xmodmap -e “remove lock = Caps_Lock”
only works if your caps lock is off
How Can I Disable the Keyboard in RHEL-4.
to Aovid the Input In My Absens.
Pradeep
@Pradeep
Maybe try lock screen?
xmodmap -e “remove lock = Caps_Lock” is my favorite command to add as ´startup application´ :)
xmodmap -e “remove lock = Caps_Lock” works as a charm, but when you replug the USB keyboard caps lock is functional again.
I use this to discourage my son of typing caps-lock-on-character-caps-lock-off. This sounds very unusual, yet I discovered there are more people who have developed this unwanted habit.
As it seems, I should link the xmodmap command to a udev event.
jlinkels