26

Jul

Filed in Bash, Code |

Recently I ran across a trick on the net. I use iPython quite a bit, and I love how I can type a partial history command, and then use up/down to cycle through the recently used commands/code lines. I thought it would be pretty cool to have this same technique available in the bash prompt. After a bit of searching, I found some results, so here you go:

# Enable bash history
export HISTCONTROL=erasedups
export HISTSIZE=10000
shopt -s histappend

# These set up/down to do the history searching
bind '"\e[A"':history-search-backward
bind '"\e[B"':history-search-forward
  • sebastian

    thanks — that’s awesome! =)

blog comments powered by Disqus