I've found the answer on Server Fault: Create a public SSH key from the private key?
-y outputs the public key:
ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
As a side note, the comment of the public key is lost. I've had a site which required the comment (Launchpad?), so you need to edit
~/.ssh/id_rsa.pub and append a comment to the first line with a space between the comment and key data. An example public key is shown truncated below.
ssh-rsa AAAA..../VqDjtS5 ubuntu@ubuntu
For keys that were added to the SSH Agent (a program that runs in the background and avoids the need for re-entering the keyfile passphrase over and over again), you can use the
ssh-add -L command to list the public keys for keys that were added to the agent (via
ssh-add -l). This is useful when the SSH key is stored on a smart card (and access to the private key file is not possible).