I'm searching for a way to remap certain keys in ubuntu.
i'd like to change PgUp to Home or PgDown to End.
Does a built-in command or a tool exist reassign keys in Ubuntu/GNOME?
For remapping certain keys you need two tools. First
Note: These change are for the active x session only and will be lost after reboot. When you want to save the changes permanently you have to run the following commands after the ones above:
(it creates a files called .Xmodmap in your home directory)
Then you have to create a file called
source: Ubuntu Foruns
If the key you are remapping has different behavior depending on a state (
like how the keys in the numeric keyboard depend on Num_Lock) you simply have to do
Suppose, for example, that you want to get a period instead of a comma on the numeric keyboard (useful for most programmers), but you want to keep the "delete" behavior when numlock is off.
|show 1 more comment|
I've just had an afterthought.. I think you may mean something entirely different by "remap".. but I'll leave my answer as it is... (I don't know how to re-assign one key to behave as another)
UPDATE: my 'afterthought' has been confirmed; ( I've answered the wrong question :)... please see NES's answer.
There are two general ways to
For 'local to a program' methods, there is sometimes a way to change keybindings offered by the app itself... eg.
Most Ubuntu programs are Gnome based and there is a specific utility to modify the keybinding for any menu item of these Gnome apps... It is called
Otherwise you can set up Global hotkeys. I use a program called xbindkeys , and there is also an option available via the Main Menu -- Preferences, called
If you use xbindkeys, you will need to add it to your "Startup Applications" (Main Menu -- Preferences) ... Also (as suggested by Stefano Palazzo) I have previously written a more detailed description of xbindkeys in an answer on this askubuntu page
|show 1 more comment|
Here is how I tried to switch the mapping of the ENTER key to the SHIFT key (and vice versa):
(ignore the next fifty lines or so)
What's important is the third line of each keypress:
REVERSE THE MAPPING:
SAVE THE RESULTS:
The main problem was that the reversal did NOT work. The ENTER key was mapped to the SHIFT_R key; but the SHIFT_R key was not mapped to the ENTER key. Go figure.
checkout my answer here. It doesn't worth copy and paste same answer.
Perhaps it would help you.
If you're trying to move a Shift key, there are a few extra steps:
In order to do global remaps independently of X, you can make use of console-setup(5) instead.
In my case I wanted to remap Caps Lock key to D, since my D-key is broken :)
First I used dumpkeys(1) to get a template for a mapping, in the case of the D-key, the interesting bit is the mapping for keycode 32 (on my keyboard); Note that there are two spaces in the grep pattern!
In order to change the map to apply to Caps Lock (keycode 58 on my keyboard) instead
Now it reads
To add this remap to the default map, it simply needs to be appended to the remap include file for console-setup
and console-setup needs to be reconfigured (skipping low priority questions with
Now the remap should be completed, and be loaded automatically on boot.
Try http://www.jwz.org/xkeycaps/ I have not tried it myself but looks like it might help you do the same.