Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Having TLS certificate in local file, I can display its details using syntax like:

openssl x509 -text -noout -in cert_filename

Is there any way to display remote SMTP/POP3/HTTP server's TLS certificate in this same format in bash terminal?

share|improve this question
up vote 6 down vote accepted

openssl s_client -connect server:port display some informations. Maybe is it sufficient for you. It is not exactly the same format, but it can help.

share|improve this answer
You can also add -starttls PROTO if the protocol is not native SSL/TLS. For example, -starttls pop3. – Michael Kjörling Aug 8 '14 at 19:48

You can use OpenSSL's s_client command to dump the certificate in PEM format (and lots of other stuff, but -in doesn't seem to care about it). All you need is some output redirection to convince x509 to parse that:

openssl x509 -text -noout -in <(openssl s_client -connect server:443)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.