Bash: smart autocomplete based on history

autocompletebash

I once found an amazing bash option, but now I can't remember how to re-enable it.

It extended autocomplete to look at your most recent history. So if you'd previously typed open index.html and then open map.html, typing

$ op

and pressing Tab once would autocomplete to open map.html. Pressing Tab again would autocomplete to open index.html.

Does anyone know how I can re-enable this?

Best Answer

Run in your bash:

cat >> ~/.inputrc <<'EOF'
"\e[A": history-search-backward
"\e[B": history-search-forward
EOF

Relogin to the ssh session, or simply reload inputrc:

bind -f  ~/.inputrc

Now use and after entering the beginning of the command - it will auto-complete from history.

Related Question