0

I used to create a simple .inputrc in my users directory and add the following:

"e[A": history-search-backward
"e[B": history-search-forward
"e[C": forward-char
"e[D": backward-char

reload bash

exec bash -l

And then be easily able to traverse the bash history with the arrow keys.

Now in ubuntu 18 the same does not work.. i don't know if it is not reading the inputrc file or something else.. anyone else had the same issue and found a resolution?

i also tried from this answer ~/.inputrc file not sourcing correctly

bind -f  ~/.inputrc

But this still is not working for me.. :/

John
  • 235

1 Answers1

4

My guess is that the key bindings need a backslash "\". But I can't tell if that's all you need. I'm on Debian.

"\e[A": history-search-backward
"\e[B": history-search-forward
"\e[C": forward-char
"\e[D": backward-char

Here is an example how you can check if a binding is active.

  • check if history-search-backward is set

    $ bind -p|grep history-search-backward
    # history-search-backward (not bound)
    
  • test which command has key sequence "\e[A"

    $ bind -p|grep "\\e\[A"
    "\e[A": previous-history
    
  • write new key binding to ~/.inputrc and reload

    $ echo '"\e[A": history-search-backward' >> ~/.inputrc
    $ bind -f ~/.inputrc
    
  • check again if history-search-backward is set

    $ bind -p|grep history-search-backward
    "\e[A": history-search-backward
    
Freddy
  • 25,565