This can be done with the ssh-keygen command.

Example for SSH server key:

$ ssh-keygen -lf /etc/ssh/ssh_host_rsa_key.pub

Example for user's key:

$ ssh-keygen -lf ~/.ssh/id_rsa.pub

Generate public SSH key from private key

$ ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub