Extract your public key from your private key

By jgottschlich23. October 2017

If you should ever lose your public key, but still have your private key, you can always compute your public key from your private key.

The following command prints your public key to stdout (with id_rsa being your private key file, e.g. under ~/.ssh)

ssh-keygen -y -f id_rsa

Or just pipe directly to a file with:

ssh-keygen -y -f id_rsa >

Now you can redistribute your public key where ever you need it.

Any questions? Please comment.