ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
-f filename Specifies the filename of the key file. -y This option will read a private OpenSSH format file and print an OpenSSH public key to stdout.