Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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

2 Answers 2

up vote 4 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.