How to add zsh up/down history search in bash

Michael Roma on Feb 16, 2020

I’ve really grown to like how the up/down arrow works in zsh where it searches through your history that starts with whatever you already typed. Every time I log into a session that is bash, I wish it had that feature. Below are commands that can be added to your .bashrc file that will give you similar functionality. It rebinds the up/down arrow to a history search function.

bind '"\e[A": history-search-backward'
bind '"\eOA": history-search-backward'
bind '"\e[B": history-search-forward'
bind '"\eOB": history-search-forward'