Linux:
Example given: get the serial number on the TLS certificate google.com uses you can use this command:
echo -n | openssl s_client -connect google.com:443 2>&1 | openssl x509 -noout -serial
If your webserver is providing the TLS certificate on a different port just change port 443 to your HTTPS port.
Using example.com with port 1443 (it’ll fail since example.com doesn’t listen on port 1443)
echo -n | openssl s_client -connect example.com:1443 2>&1 | openssl x509 -noout -serial