Can a domain consist of only TLD (top level domain)?

1.3k Views Asked by At

I am building a validation function for domains and was wondering.

Can a valid domain consist of only TLD (or one word domain)?

Example - net com exit museum

Is that a valid domain?

1

There are 1 best solutions below

1
Dusan Bajic On BEST ANSWER

Yes. Quick and dirty check:

$ for tld in $(wget -O- -q https://data.iana.org/TLD/tlds-alpha-by-domain.txt); do result=$(dig +short ${tld}. a); if [ -n "$result" ]; then echo "$tld $result"; fi; done

then, for example: http://ai/