Smart up and down on the command line

I bet everyone already knows this, but I just learned it and love it:

# put this in ~/.inputrc

# By default up/down are bound to previous-history
# and next-history respectively. The following does the
# same but gives the extra functionality where if you
# type any text (or more accurately, if there is any text
# between the start of the line and the cursor), the subset 
# of the history starting with that text is searched 
# Note to get rid of a line just Ctrl-C

"\e[B": history-search-forward
"\e[A": history-search-backward
# Include system wide settings which are ignored
# by default if one has their own .inputrc
$include /etc/inputrc

Lance Cameron Kidwell

7 November 2009

Posted in Miscellania

In lieu of comments, please talk about this post with smart people at Hacker News Hacker News or, if you're the twittering sort, click this handsome button:

Prove Me Wrong: