HOWTO Autocomplete hostnames with bash while using SSH

This article was first written in October 2007 for the BeezNest 
technical website (

On most GNU/Linux distributions, bash is able to read hostnames in  /.ssh/known_hosts to autocomplete ssh commands. For security reasons though, hostnames are no longer stored in clear text in those files on most distributions, defeating this feature of bash’s autocompletion.

To tell SSH (client) to not obfuscate hostname, just set the HashKnownHosts option to no in /etc/ssh/ssh_config.

Related Posts

Easily avoid using your password in an SSH connexion: ssh-copy-id

On Linux systems, there used to be a mildly complicated but tedious way...

Using SSH for tunneling

A very useful resource (in French) to use SSH, with specific use cases:...