在.bashrc文件中添加以下命令

1
2
3
4
5
if [[ $- == *i* ]]
then
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
fi

即可通过上下键快速查找历史命令