I bound some keys by mistake, and they don't work any more, such as HOME, END, UP, DOWN, LEFT, RIGHT.

Is there a way to reset all the bound keys to their original state?

migrated from stackoverflow.com Sep 20 '11 at 10:52

This question came from our site for professional and enthusiast programmers.

  • 1
    Its usually defined in your .inputrc. – Lynch Sep 20 '11 at 3:31
  • there is nothing in my .inputrc, and /etc/inputrc only defines some of them. So i wonder where all these r defined? – LarryLv Sep 20 '11 at 4:00

If it's bash that you misconfigured, you might have done so either in ~/inputrc or in ~/.bashrc. ~/.inputrc is the configuration file for the readline library, which is used by bash and a few other command-line programs to read input. ~/.bashrc is the configuration file of bash itself.

If you start a shell with bash --norc, your ~/.bashrc isn't read, but your ~/.inputrc is. If you start a shell with HOME=/none bash, neither file is read, nor your previous shell history.


You can reset bash key bindings to their original state: set -o emacs

This sets all key bindings to the default (which is emacs key bindings). Alternatively, if you prefer, you can do: set -o vi

You can also use bind -r <keycode> to remove a single key binding.

More details can be found in the bash man page under "SHELL BUILTIN COMMANDS", then look for "set" and also "bind".


Try xmodmap; the following command will show you the current key bindings:

xmodmap -pke

  • xmodmap has a vastly different function than the one being referred to in the question. – Chris Down Sep 21 '11 at 0:51
  • It's far too vague to say that. Thanks anyway. – rjp Sep 21 '11 at 3:56
  • 1
    I just reread the question and yes, you're correct (I misread the question). But: if it's not readline bash key bindings causing this, xmodmap is a reasonable place to look. Thanks. – rjp Sep 21 '11 at 4:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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