How to remove old entries from known_hosts?

Darren Tucker dtucker at
Thu Feb 15 00:06:55 AEDT 2024

On Wed, 14 Feb 2024 at 22:52, Chris Green <cl at> wrote:
> Is there any way to remove old entries from the known_hosts file? With
> the hashed 'names' one can't easily see which entries are which.

ssh-keygen -R.  From the man page:

     -R hostname | [hostname]:port
             Removes all keys belonging to the specified hostname (with op-
             tional port number) from a known_hosts file.  This option is use-
             ful to delete hashed hosts (see the -H option above).

Darren Tucker (dtucker at
GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860  37F4 9357 ECEF 11EA A6FA
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.

More information about the openssh-unix-dev mailing list