Just came across this today… Really useful, since 90% of my job requires SSHing off to remote hosts…
From drawohara:
Stick this in your ~/.bashrc
SSH_COMPLETE=( $(cat ~/.ssh/known_hosts | \ cut -f 1 -d ‘ ’ | \ sed -e s/,.*//g | \ uniq | \ egrep -v [0123456789]) ) complete -o default -W "${SSH_COMPLETE[*]}" ssh
This does a lookup for all the hosts in your ~/.ssh/known_hosts file, as a source for the autocompletion.