ssh-keygen -y -f ~/.ssh/id_ed25519

Category: Security & Hardening

ssh-keygen -y -f ~/.ssh/id_ed25519

Derive the public key from a private key

Recomputes and prints the public key that matches the private key, handy when you lost the .pub file. The public key is mathematically derived, so it always matches. Add a redirect to ~/.ssh/id_ed25519.pub to recreate the file with correct permissions.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.