How to find public key type of SSL/TLS X.509 certificate using OpenSSL

Use the following command to print, replacing cert.pem by the path of your certificate:

openssl x509 -noout -text -in cert.pem | grep -i "Public Key Info" --after 3

Example output:

Subject Public Key Info:
    Public Key Algorithm: rsaEncryption
        RSA Public-Key: (2048 bit)
        Modulus: