Raymii.org 
                         
                    
                
                
                  Quis custodiet ipsos custodes?Home | About | All pages | Cluster Status | RSS Feed
Bash Incremental History Search / Autocomplete
Published: 26-06-2013 | Author: Remy van Elst | Text only version of this article
❗ This post is over twelve years old. It may no longer be up to date. Opinions may have changed.
This little snippet for your .bashrc or your .inputrc changes the Up/Down arrow behavior to autocomplete what is already typed instead of just go back in history.
 Recently I removed all Google Ads from this site due to their invasive tracking, as well as Google Analytics. Please, if you found this content useful, consider a small donation using any of the options below. It means the world to me if you  show your appreciation and you'll help pay the server costs:
 GitHub Sponsorship
 PCBWay referral link (You get $5, I get $20 after you've placed an order)
 Digital Ocea referral link  ($200 credit for 60 days. Spend $25 after your credit expires and I'll get $25!)
 
Normally when you press Up in Bash you get the previous command. With these
lines that is changed. If you typed vim filename, then top and then again
vim and pres up, it will autocomplete to vim filename instead of go back to
top.
Either in your .bashrc:
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
Or in your .inputrc:
"\e[A": history-search-backward
"\e[B": history-search-forward