21

I got this working before (I believe it was on a 15.10, I recently downgraded to the LTS 14.04).

According to this post the following should work

~ $ cat ~/.inputrc 
"\e[A":history-search-backward
"\e[B":history-search-forward

But when I save that .inputrc and open a new terminal, typing PageUp or PageDown just prints the tilde character ~ in the terminal, instead of doing the search.

Any help appreciated.

Juicy
  • 935

2 Answers2

31

Try this in ~/.inputrc

"\e[5~": history-search-backward   
"\e[6~": history-search-forward  

and reopen terminal.

EdiD
  • 4,617
  • 3
  • 27
  • 41
11

\e[A and \e[B are actually the Up and Down arrow keys. To test what a key is, run cat and then press the key:

$ cat
^[[A
^[[B

^[[5~
^[[6~

Those are , , Page Up and Page Down respectively. The ^[ stands for Esc, or \e in terms of .inputrc.

So, if you added \e[A and \e[B, you should be able to browse history using arrow keys. For Page Up and Page Down, use \e[5~ and \e[6~.

muru
  • 207,228