ssh-keyscan

Get the public SSH keys of remote hosts. More information: https://man.openbsd.org/ssh-keyscan.

ssh-keyscan {{hostname}}

ssh-keyscan -p {{port}} {{hostname}}

ssh-keyscan -t {{rsa,dsa,ecdsa,ed25519}} {{hostname}}

ssh-keyscan -H {{hostname}} >> ~/.ssh/known_hosts