This zshrc snippet automatically search for ~/.ssh/known_hosts for hostnames for ssh, scp, and ping command. It requires perl. compctl -f -k "( `cat .ssh/known_hosts | perl -lnae '@C=split(",", $F[0]); print for @C'` )" ssh scp ping

Labels: autocomplete, perl, ssh, zsh