To enable ssh autocompletion in Debian and Ubuntu:
sudo apt-get install bash-completion
Note that this has nothing at all to do with known_hosts hashing, contrary to what was stated above and the original question. If you wanted to autocomplete from known_hosts, then of course you would have to disable hashing, but that is strongly recommended against.
For example, I have:
in my .ssh/config, and I still have ssh auto-completion working just fine against hosts listed in .ssh/config and /etc/hosts. You do need to add the host to .ssh/config as the OP stated:
(Or, you can add a host entry to /etc/hosts, which is another source for the Debian/Ubuntu scripts.)
Then, you can just type
ssh my-awe<tab> and it will be automagically completed. Again, this is even if you HashKnownHosts, which is highly recommended. (Note that bash completion needs to be enabled in your bash shell, and you need to specifically have those scripts installed as above for your distribution.)
Then, add these lines to your
.bashrc to enable it (requires a logout and log back in, or just a new
bash typed in to launch a new shell. (You don't need to enable if it's already enabled in
if [ -f /etc/bash_completion ]; then
This will enable ssh autocompletion (among other things!) from
Note that Debian defaults to ash instead of bash. You can switch to bash easily:
sudo usermod -s /bin/bash "$USER"
(You'll need to log out and log back in for this to take effect.)