This One Simple Bash Trick Will Save You Thousands of Hours a Week

There are lots of ways to enable hostname completion in Bash so it's quicker to connect with SSH. This method (original gist) is the easiest; just drop the command into your .bash_profile. This works in macOS and OS X, and probably Mac OS X as well. complete -W "$(echo `cat ~/.ssh/known_hosts | cut -f 1 -d ' ' | sed -e s/,.*//g | uniq | grep -v "\["`;)" ssh It doesn't work in some flavors of Ubuntu, however, because apparently that distro hashes the hostnames in ~/.ssh/known_hosts. If you're a Ubuntu user, you probably already knew that.