use openssl to retrieve certificate

These days I am working on a certificate issue. During the debug session, I got a trick about how to retrieve the certificate from a server without using a browser. This is convenient in non-GUI environment, for example, shell environment. Mark it here for further reference. The command is as below:

openssl s_client -showcerts -connect 10.10.10.10:443

If you have a CA certificate in hand and want to use it to verify the certificate from the server, use the below command:

openssl s_client -showcerts -connect 10.10.10.10:443 -CAfile /path/to/ca/certificate