Fetch TLS Certificate

openssl s_client -showcerts -servername "TARGET" -connect "TARGET":443 2>/dev/null | openssl x509 -inform pem -noout -text 2>/dev/null

Pipe echo into s_client so it doesn’t hang waiting on stdin:

echo | openssl s_client -showcerts -servername "TARGET" -connect "TARGET":443 2>/dev/null | openssl x509 -inform pem -noout -text