Generate public SSH key from private key

Suppose I have a SSH keys pair, but I’ve deleted the public key. I have the private key only. How can I regenerate public key from private key ?

man ssh-keygen says:

-y      This option will read a private OpenSSH format file and print an
         OpenSSH public key to stdout.

The following command will generate a public key for you:

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

Check ssh key length

Check ssh key length

If you want to check the ssh key length you can use the following commands for it.

knesenko@knesenko-centos7:~/.ssh$ ssh-keygen -l -f id_rsa
2048 1e:0f:a9:ba:a6:cf:7a:54:e3:4d:56:99:35:f6:6e:bb  knesenko@test.com (RSA)
knesenko@knesenko-centos7:~/.ssh$ openssl rsa -text -noout -in id_rsa
Private-Key: (2048 bit)
...
...
...