Interested in buying ad space on this blog?
You can, on BuySellAds.com

Do you train Kung Fu?
Or know someone who does?
Then check out KungFuPeople.com
Mobile version of this pagePrevious:
I'm back and awake!
Next:
Time Machine Ballistics
I'm back and awake!
Next:
Time Machine Ballistics
Related blogs
Overcomplicated password requirements on Oystercard.comRelated by category
Disable Caps Lock in Linux
21st of October 2004
I never use the Caps Lock button. Never. The only time I "use" it is when I accidently press it and start typing things in UPPERCASE. To disable it in Linux all you have to do is enter this on the command line:
$ xmodmap -e "remove lock = Caps_Lock"
To set this permanently, just stick the above line in your ~/.bashrc file (or /etc/bash.bashrc if you're root) so that it looks something like this:
if [ "$PS1" ]; then
# Disables the bloody CapsLock button
xmodmap -e "remove lock = Caps_Lock"
...
fi
Comment
29 comments so farRoar Granerud -
24th March 2006
[«« Reply to this]
Wonderfull. Utterly wonderful. Now I only need to replace the physical button that I threw away yesterday. Death to CAPS LOCK
Wonderfull. Utterly wonderful. Now I only need to replace the physical button that I threw away yesterday. Death to CAPS LOCK
Caps Lock Sucks Goats -
8th May 2006
[«« Reply to this]
Thank you thank you thank you. This rocks big time. NO MORE LOOKING LIKE SOME POWERPOINT-USING MORON!
Thank you thank you thank you. This rocks big time. NO MORE LOOKING LIKE SOME POWERPOINT-USING MORON!
Anonymous -
18th July 2006
[«« Reply to this]
Many thanks for this tip...can't tell you how many times I've boned something up b/c of the friggin' capslock!
Many thanks for this tip...can't tell you how many times I've boned something up b/c of the friggin' capslock!
Peter -
26th September 2006
[«« Reply to this]
JUCHU!!!!! DRECKDING!!!! SCHEISSE CAPSLOCK ENDLICH WEG!!!
JUCHU!!!!! DRECKDING!!!! SCHEISSE CAPSLOCK ENDLICH WEG!!!
RANDY J. ROGERS -
29th November 2006
[«« Reply to this]
WHY THE ATTACK ON CAPS-LOCK? I COMPOSE ALL MY CODE AND CORRESPONDENCE IN CAPS SO THAT I AM MORE EASILY UNDERSTOOD AND GET THE ATTENTION I DESERVE. I APPLIED YOUR SILLY PATCH AND NOW I MUST HOLD DOWN THE SHIFT KEY WHENEVER I TYPE. WHAT A PAIN!
WHY THE ATTACK ON CAPS-LOCK? I COMPOSE ALL MY CODE AND CORRESPONDENCE IN CAPS SO THAT I AM MORE EASILY UNDERSTOOD AND GET THE ATTENTION I DESERVE. I APPLIED YOUR SILLY PATCH AND NOW I MUST HOLD DOWN THE SHIFT KEY WHENEVER I TYPE. WHAT A PAIN!
Larry Phillips -
29th December 2006
[«« Reply to this]
I love it! After applying your line in my .bashrc, I went looking for a way to disable the Num Lock key, wanting it to always be in numeric mode. I could not find any way to do it, but I did discover that you can do the same thing by using a line something like..
xmodmap -e "keycode 79 = KP_7 KP_7"
This doesn't disable the Num_Lock, but it doesn't matter.
Use "xmodmap -pke" first, to check which keycodes are relevant.
I love it! After applying your line in my .bashrc, I went looking for a way to disable the Num Lock key, wanting it to always be in numeric mode. I could not find any way to do it, but I did discover that you can do the same thing by using a line something like..
xmodmap -e "keycode 79 = KP_7 KP_7"
This doesn't disable the Num_Lock, but it doesn't matter.
Use "xmodmap -pke" first, to check which keycodes are relevant.
Cedric -
10th December 2007
[«« Reply to this]
Thank you for this tip. I however wanted to let caps lock do the same as shift. This did the trick for me:
xmodmap -e "remove lock = Caps_Lock"
xmodmap -e "add shift = Caps_Lock"
I've linked to this page from my homepage:
http://home.tiscali.nl/cedric/Linux/Software/linux-trics/linuxtricsindex.html
Thank you for this tip. I however wanted to let caps lock do the same as shift. This did the trick for me:
xmodmap -e "remove lock = Caps_Lock"
xmodmap -e "add shift = Caps_Lock"
I've linked to this page from my homepage:
http://home.tiscali.nl/cedric/Linux/Software/linux-trics/linuxtricsindex.html
NicoLarve -
11th January 2008
[«« Reply to this]
Just G.R.E.A.T. !
... As I used to remove the caps lock keys on my keyboards !
I can now restaure them to their original places !
Just G.R.E.A.T. !
... As I used to remove the caps lock keys on my keyboards !
I can now restaure them to their original places !
Nick Ring -
17th February 2008
[«« Reply to this]
Good work!
Alternatively, for the vi/vim users, turn your Caps Lock into an Escape key. Now you can switch modes without any stretching off the home row.
Add the following to ~/.Xmodmap
remove Lock = Caps_Lock
keysym Caps_Lock = Escape
and the following to ~/.bashrc
if [ "$PS1" ]; then
xmodmap ~/.Xmodmap
...
fi
Good work!
Alternatively, for the vi/vim users, turn your Caps Lock into an Escape key. Now you can switch modes without any stretching off the home row.
Add the following to ~/.Xmodmap
remove Lock = Caps_Lock
keysym Caps_Lock = Escape
and the following to ~/.bashrc
if [ "$PS1" ]; then
xmodmap ~/.Xmodmap
...
fi
hosiawak -
18th February 2008
[«« Reply to this]
For Emacs's users: it's better to swap CTRL with Caps Lock, to do this, just put:
Option "XkbOptions" "ctrl:swapcaps"
inside Section "InputDevice" of your xorg.conf
For Emacs's users: it's better to swap CTRL with Caps Lock, to do this, just put:
Option "XkbOptions" "ctrl:swapcaps"
inside Section "InputDevice" of your xorg.conf
InYourBase -
19th February 2008
[«« Reply to this]
If you use KDE, go to Control Center-> Regional & Accessibility-> Keyboard Layout-> xkb options, click "Enable xkb options" and there are some options under "Ctrl key position"
If you use KDE, go to Control Center-> Regional & Accessibility-> Keyboard Layout-> xkb options, click "Enable xkb options" and there are some options under "Ctrl key position"
Alf -
23rd July 2009
[«« Reply to this]
Thanks InYourBase for the KDE tip!
I am xmodmap aware, but KDE supercedes XModmap modifications, and I would never haved found these options by myself.
You made my day :-)
Thanks InYourBase for the KDE tip!
I am xmodmap aware, but KDE supercedes XModmap modifications, and I would never haved found these options by myself.
You made my day :-)
Anonymous -
13th April 2008
[«« Reply to this]
So cool! So nice to get rid of the blasted caps lock (especially for someone like me who cannot type (blindly) and hence cannot see what (s)he's typing. So nice :-)
So cool! So nice to get rid of the blasted caps lock (especially for someone like me who cannot type (blindly) and hence cannot see what (s)he's typing. So nice :-)
Anonymous -
13th April 2008
[«« Reply to this]
And it carry's over to my rdesktopped Windows window. So much value for so little work :-)
And it carry's over to my rdesktopped Windows window. So much value for so little work :-)
p -
7th October 2008
[«« Reply to this]
I used to be removing the bloody CL key from all keyboards that I worked on manually, but that is not possible on laptops. Now this trick saves my day! Thanks!
I used to be removing the bloody CL key from all keyboards that I worked on manually, but that is not possible on laptops. Now this trick saves my day! Thanks!
KG -
18th February 2009
[«« Reply to this]
Ugh - thank you. My Eee PC laptop keyboard was damaged and the CL key was stuck on - this makes my laptop usable again until the new keyboard arrives...
Ugh - thank you. My Eee PC laptop keyboard was damaged and the CL key was stuck on - this makes my laptop usable again until the new keyboard arrives...
kalpesh -
27th March 2009
[«« Reply to this]
wonderful abt Caps Lock...But I can you disable any key using same command.......
wonderful abt Caps Lock...But I can you disable any key using same command.......
Peter Bengtsson -
28th March 2009
[«« Reply to this]
I actually don't know. I only just worked on the Caps Lock and haven't had a need to disable any other key. But I have thought about the Ctrl and Alt keys on the RIGHT because I never use them and perhaps they can be used for something else like to change language or something.
I actually don't know. I only just worked on the Caps Lock and haven't had a need to disable any other key. But I have thought about the Ctrl and Alt keys on the RIGHT because I never use them and perhaps they can be used for something else like to change language or something.
fred -
19th May 2009
[«« Reply to this]
First, thanks to Peter!
@kalpesh: maybe not exactly the answer you are looking for but I believe it's "yes, you can". No HowTo provided here, though... But combining "man xmodmap" and xev, you can probably do miracles with your keyboard ;-)
First, thanks to Peter!
@kalpesh: maybe not exactly the answer you are looking for but I believe it's "yes, you can". No HowTo provided here, though... But combining "man xmodmap" and xev, you can probably do miracles with your keyboard ;-)
gavin -
18th March 2010
[«« Reply to this]
How do I toggle the capslock on and off? What I mean is, if I type `LS` or `CD` in bash, I'd like LS and CD alias to turn off caps and send `ls` or `cd` commands. I don't want to deactivate caps completely, I just want to be able to toggle it off when I forget I have it on.
How do I toggle the capslock on and off? What I mean is, if I type `LS` or `CD` in bash, I'd like LS and CD alias to turn off caps and send `ls` or `cd` commands. I don't want to deactivate caps completely, I just want to be able to toggle it off when I forget I have it on.
Oz DiGennaro -
2nd August 2010
[«« Reply to this]
I believe we need a new world-wide movement. The only possible use of caps lock is for lawyers-who-shout-to-make-it-seem-important and other misguideds. We will sneak into the keyboard factories and modify the production hardware to omit the caps lock key. A hole like a missing tooth. Finally we'll be able to stop all this effort disabling something that should NEVER have been there.
I believe we need a new world-wide movement. The only possible use of caps lock is for lawyers-who-shout-to-make-it-seem-important and other misguideds. We will sneak into the keyboard factories and modify the production hardware to omit the caps lock key. A hole like a missing tooth. Finally we'll be able to stop all this effort disabling something that should NEVER have been there.
jody -
17th September 2010
[«« Reply to this]
I am also an intense hater of CapsLock,
and was happy to find your excellent tip, which has worked well so far. But on my new Installation, whenever i open a new terminal (Ctrl-Alt-T) from an open xterm, i get a message like the following in the new window
xmodmap: please release the following keys within 2 seconds:
Control_L (keysym 0xffe3, keycode 37)
Shift_L (keysym 0xffe1, keycode 50)
before the fist prompt appears (BTW; i hadn't pressed any of those keys). This message does not appear when xterm is started from the menu. When i remove the xmodmap-command, this message does not occur. Does anybody know what this means?
I am also an intense hater of CapsLock,
and was happy to find your excellent tip, which has worked well so far. But on my new Installation, whenever i open a new terminal (Ctrl-Alt-T) from an open xterm, i get a message like the following in the new window
xmodmap: please release the following keys within 2 seconds:
Control_L (keysym 0xffe3, keycode 37)
Shift_L (keysym 0xffe1, keycode 50)
before the fist prompt appears (BTW; i hadn't pressed any of those keys). This message does not appear when xterm is started from the menu. When i remove the xmodmap-command, this message does not occur. Does anybody know what this means?
Colin -
1st October 2010
[«« Reply to this]
Yes you did: you've just told us you pressed Ctrl, and I'm guessing that you pressed Shift as well (rather than Alt) if you're in Gnome.
I get
t (keysym 0x74, keycode 28)
as well.
I don't know the answer yet, but it's clear what's going on.
Yes you did: you've just told us you pressed Ctrl, and I'm guessing that you pressed Shift as well (rather than Alt) if you're in Gnome.
I get
t (keysym 0x74, keycode 28)
as well.
I don't know the answer yet, but it's clear what's going on.


Save this page in del.icio.us
must say that a i love your work. Once i tried to sleep with caps lock, but he was too tight i'm afraid.
Yeah, that is great for vi