You often end up having to share your SSH public key with someone but realise that you only have the private key with you.

Use the following command to extract the public key from the SSH private key.

ssh-keygen -f <path-to-private-key> -y

This will print out the SSH Public Key to the stdout.