Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 07-07-2008, 03:23 PM   #1
LQ Newbie
Registered: Jun 2008
Posts: 6

Rep: Reputation: 0
How can I map the control key to the caps lock key in Linux?

How might I map the control key to the caps lock key?
I need the caps lock key to function as the control key does from the command line as well as in programs run from the command line such as emacs.
I have found some information on the topic, but have not had any success in doing so.
Old 07-07-2008, 05:05 PM   #2
Senior Member
Registered: Jul 2006
Location: Kolkata, India
Distribution: Debian 64-bit GNU/Linux, Kubuntu64, Fedora QA, Slackware,
Posts: 2,766

Rep: Reputation: Disabled
For emacs without X, see the emacs docs.

From any of the desktops, it can be done through GUI

KDE --> control Center --> Regional & Access.. --> Keyboard Shortcuts. There is the layout option too


A. Mani
Old 07-07-2008, 05:10 PM   #3
Senior Member
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
You want to map the caps lock key to control, not the other way around.

Emacs can be run either in a text console or in X (graphics mode); the instructions for remapping keys differs.

The text console uses a program called loadkeys and X uses xmodmap.

Some examples:

Note that when using loadkeys, you will need to be root and also press ctrl+D at the end of the instructions. Or you can save the instructions to a file and run
cat file | loadkeys
Edit: Amani points out that you can use the KDE menus instead. Gnome, as far as I can tell, does not have this option, but if you use KDE then that The menu may be simpler than editing the .xmodmap file.

Last edited by rjlee; 07-09-2008 at 04:43 PM. Reason: Update post to comment incorrect info
Old 07-08-2008, 06:42 PM   #4
LQ Veteran
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 5,965

Rep: Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222
Gnome does have this: Enter the menu at

System - Preferences - Hardware - Keyboard

choose the tab "Layout Options" and then the option "Ctrl Key Position".
Old 07-14-2008, 01:20 PM   #5
LQ Newbie
Registered: Jun 2008
Posts: 6

Original Poster
Rep: Reputation: 0
Question Still can't get the maps working in the console

Thanks All for all the help thus far!
I can successfully map the keys in the xmodmap...but am having ZERO luck in the plain ol' console. I followed the examples and did:
% loadkeys
keymaps 0-15
keycode 58 = Control
keycode 29 = Caps_Lock
(Then exited w/ Control+d)
This produced no change. I opened a new shell and there were still no changes.

I also tried:
% dumpkeys > my_keymap
% cp my_keymap trial_keymap
% emacs trial_keymap
% loadkeys trial_keymap
This produced no change either...but when I went into emacs to look at the trial_keymap -- I could see the correct changes in the file.
I got no errors when I loaded with the `loadkeys trial_keymap` command.
But there was still no effect even after I opened a new shell!

Where can I go from here?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
map control key to caps lock in Xemacs gandalf3 Linux - Software 0 12-19-2006 10:05 AM
CAPS lock key is now my left-CTRL key?! andrew_cz General 2 05-03-2006 07:32 AM
How do I switch the caps lock key out? timcharper Linux - Software 2 08-05-2005 01:00 PM
caps lock key neo77777 Linux - General 4 02-01-2002 11:32 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:34 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration