1 首先在该用户家目录(home directory)下新建一个 .inputrc 文件,并在其中写入以下配置,如下:
root@tenggeer ~]# cat .inputrc
“\e[A”: history-search-backward
“\e[B”:history-search-forward
set show-all-if-ambiguous on
set completion-ignore-case on
如果以上做法失败,则可以参考stackoverflow: How do I change bash history completion to complete what’s already on the line?
在~/.bashrc 中添加如下内容(注意空格):
if [[ $- == *i* ]]
then
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
fi