[ACCEPTED]-how to check if a host is in your known_host ssh-expect

Accepted answer
Score: 42

Try: ssh-keygen -F <hostname>

Will show the known_hosts line(s) if the hostname 3 fingerprint is found and the command returns 2 0, otherwise nothing is shown and the command 1 returns 1.

Score: 3

According to ssh-keygen(1) man page

-F hostname 6 Search for the specified hostname in a 5 known_hosts file, listing any occurrences 4 found. This option is useful to find hashed host 3 names or addresses and may also be used 2 in conjunction with the -H option to 1 print found keys in a hashed format.

More Related questions