I have a line in my .bashrc the following line:

bind '"\e[A": history-search-backward'

that causes that when I write "abc" to command prompt and press up arrow, bash searches in history only for commands that start with "abc". All is fine until I run top (and maybe some other applications that I am not sure about, with top, I am sure) when this behaviour is reversed to normal search. However, when I run bind '"\e[A": history-search-backward' in terminal, nothing changes and I have to kill and restart the terminal to get the old behaviour back. Is there a way to reverse it (or prevent it from happening?) This happens in gnome-terminal and xterm in Unity and Gnome Shell. tty seems to be not affected.

My -bashrc on top of stok ubuntu .bashrc is this:

bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
# that behaviour is for pageup and pagedown
bind '"\e[5~": previous-history'
bind '"\e[6~": next-history'

# show possibilities if tab ambigious
set show-all-if-ambiguous on
# ignore case when completing, lets see how it works
set completion-ignore-case on

shopt -s cdspell
HISTTIMEFORMAT="%h/%d - %H:%M:%S "
shopt -s histappend
PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"

Try edit binds in /etc/inputrc file.

I use 'history-search-backward' on all linux systems and I have no problem with top.

If you have problems with editing the file, see my answer here.

  • Hm, you mean adding "\e[5C": history-search-backward "\e[6D": history-search-forward to that file? Anywhere? I do not understand the #if – sup Jun 17 '13 at 23:31
  • Hm, it works fine in tty, the problem is with (it affects both unity and gnome shell). – sup Jun 17 '13 at 23:38
  • The #if here was mentioned in case that the inputrc file is empty. In that case you could see from my answer what to write in this file. – Wolfy Jun 18 '13 at 12:22
  • Well, editing inputrc does not change anything anyway – sup Jun 18 '13 at 15:47

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.