How to get website's https certificate on linux command line?

I can use wget or a similar command line tool to get an HTTPS response from a server.

On Firefox/chrome browser, I can simply download the certificate in pem format through the user interface, then add it to my trust host list.
How can I download the same HTTPS certificate through the Linux command line?

Thanks.

>Solution :

Already answered here

Just use openssl command

openssl s_client -showcerts -connect server.edu:443 </dev/null 2>/dev/null|openssl x509 -outform PEM >mycertfile.pem

Leave a Reply