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?

  • 1
    Its usually defined in your .inputrc.
    – Lynch
    Sep 20, 2011 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, 2011 at 4:00

3 Answers 3


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".

  • use 'bind -r <keycode>' if you can't type the key. keycode.info
    – alchemy
    Mar 20, 2020 at 17:46
  • ..and use * in place of a single key if you can't even type a key needed to edit .bashrc or type the above command, ie if you bound any of the keys b,i,n,d,-,r,#s by accident. Or use sh shell to edit .inputrc (though that didnt work in my case)
    – alchemy
    Mar 20, 2020 at 18:21
  • I tried bash 4.2 and 4.4 versions. `set -o emacs' can not reset key bindings in both.
    – Joe
    Dec 27, 2022 at 6:24

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

xmodmap -pke

  • 2
    xmodmap has a vastly different function than the one being referred to in the question.
    – Chris Down
    Sep 21, 2011 at 0:51
  • It's far too vague to say that. Thanks anyway.
    – rjp
    Sep 21, 2011 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, 2011 at 4:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .