Listar certificado URL=google.com;PORT=443;OLDIFS=$IFS; IFS=':' certificates=$(echo | openssl s_client -showcerts -servername $URL -connect $URL:$PORT 2>/dev/null | sed -n '/-----BEGIN/,/-----END/ {/-----BEGIN/ s/^/:/; p}'); for certificate in ${certificates#:}; do echo;echo $certificate | openssl x509 -noout -subject -issuer -dates ;echo; done; IFS=$OLDIFS El resultado es este: subject=CN = *.google.com issuer=C = US, O = Google Trust Services LLC, CN = GTS CA 1C3 notBefore=Mar 4 06:35:50 2024 GMT notAfter=May 27 06:35:49 2024 GMT subject=C = US, O = Google Trust Services LLC, CN = GTS CA 1C3 issuer=C = US, O = Google Trust Services LLC, CN = GTS Root R1 notBefore=Aug 13 00:00:42 2020 GMT notAfter=Sep 30 00:00:42 2027 GMT subject=C = US, O = Google Trust Services LLC, CN = GTS Root R1 issuer=C = BE, O = GlobalSign nv-sa, OU = Root CA, CN = GlobalSign Root CA notBefore=Jun 19 00:00:42 2020 GMT notAfter=Jan 28 00:00:42 2028 GMT Si quitamos noout nos escribe el certificado