bash autocomplete for SSH

If you are like me, and you SSH to machines through out the day, you want this. Ok. You __need__ this.

The following one liner, parses your .bash_history file and attempts to autocomplete the host you are trying to SSH to. Add this line to your .bash_profile/.bashrc file.

complete -W "$(echo $(grep '^ssh ' .bash_history | sort -u | sed 's/^ssh //'))" ssh

Of course the lookup is limited to machines you have already SSH’d to. But whatevs, it __will__ save you time and keystrokes. Time which you could use to watch re-runs of My Little Pony.