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?
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 file named
Then you have to create a file named
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 NumLock) 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.
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 Community Wiki answer (accepted above).
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
If you're trying to move a Shift key, there are a few extra steps:
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.
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.
I spent one whole day in trying to create a shortcut for
I first tried
I then tried
So I finally used Unity's own Keyboard Shortcuts -> Custom Shortcuts to setup my shortcut.
And instead of
Thank you for your interest in this question.
Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.
Would you like to answer one of these unanswered questions instead?