More specific and easier to read method with OpenSSL:
openssl x509 {<file | -in file} -noout -subject -nameopt oneline,show_type
# change -subject to -issuer (or use both!) if applicable
# if DN is long or complex enough that single-line is hard to read
# change oneline to multiline
for the cert currently used by www.example.com:
$ openssl x509 <temp -noout -subject # default does not show types
subject=C = US, ST = California, L = Los Angeles, O = Internet\C2\A0Corporation\C2\A0for\C2\A0Assigned\C2\A0Names\C2\A0and\C2\A0Numbers, CN = www.example.org
$ openssl x509 <temp -noout -subject -nameopt oneline,show_type
subject=C = PRINTABLESTRING:US, ST = PRINTABLESTRING:California, L = PRINTABLESTRING:Los Angeles, O = UTF8STRING:Internet\C2\A0Corporation\C2\A0for\C2\A0Assigned\C2\A0Names\C2\A0and\C2\A0Numbers, CN = PRINTABLESTRING:www.example.org
$ openssl x509 <temp -noout -subject -nameopt multiline,show_type
subject=
countryName = PRINTABLESTRING:US
stateOrProvinceName = PRINTABLESTRING:California
localityName = PRINTABLESTRING:Los Angeles
organizationName = UTF8STRING:Internet\A0Corporation\A0for\A0Assigned\A0Names\A0and\A0Numbers
commonName = PRINTABLESTRING:www.example.org
$
In older versions of OpenSSL the default format is PEM and you must specify -inform DER (or abbreviated -inform d) if it applies. However in 3.0.0 up, which are now the only versions supported upstream, most commands including x509 accept input as either PEM or DER automatically. (asn1parse doesn't, because unlike other commands it doesn't look at or even require the PEM label lines; its 'PEM' format actually accepts any base64, unless you specify the new option -strictpem. Sometimes this is useful, sometimes not.)