Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My Enter key recently broke and I was wondering if I could bind it to a different key in GNOME. Does anyone know how I would go about doing this?

share|improve this question
up vote 3 down vote accepted

Yes, you can change the xmodmap. First thing to do is find the keycode for the key you want to use as replacement. To do that, open a terminal, then run xev in the terminal. Move the mouse pointer into the small white window that opens up, then hit the key on the keyboard that you want to use as replacement. In the terminal you should now see a KeyPress event and a KeyRelease event. Make a note of the keycode number it shows, then close the white xev window.

Now, if you don't already have a ~/.Xmodmap file, create one with the current mapping by running

xmodmap -pke > ~/.Xmodmap

Then edit the file with your favorite editor. e.g. gedit ~/.Xmodmap.

Scroll down to the line for the keycode you noted earlier. If the keycode you want to use is 62 for instance, change the line that starts with keycode 62 = to read:

keycode  62 = Return NoSymbol Return

Next time you log in, you'll be asked if you want to load that modmap, so do that, and afterwards that key should work as a return key. For making the change in your current session, load the file with:

xmodmap ~/.Xmodmap
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.