Manun Lab
2 min read
한국어로 읽기

Check whether a domain is available from the terminal in a minute

On this page

Picking a domain for this blog meant checking more than twenty candidates. Typing each one into a registrar's search box is slow, and every result comes wrapped in "premium" badges and suggested alternatives, so it's hard to tell what's actually free. I ended up filtering them with two public lookups instead.

RDAP: the accurate check

RDAP is the replacement for old-school WHOIS. It answers in JSON, which is easier to read and easy to script. For .com, you ask the registry, Verisign.

curl -s -o /dev/null -w "%{http_code}\n" https://rdap.verisign.com/com/v1/domain/manunlab.com

A 404 means nobody holds the domain right now, so you can probably register it at the normal price. A 200 with JSON means it's taken.

If it's taken, look at the nameservers

The name I really wanted was manun.com. RDAP returned 200, as expected, and the JSON said two things:

  • The registration date under events was a long time ago. Someone has held it for years.
  • nameservers pointed at afternic.com.

The second one is the giveaway. Nameservers at afternic.com, sedo.com or dan.com mean the domain is listed on an aftermarket. You can buy it, but the seller sets the price. No price was public, and prices like that are usually in a different league from normal registration, so I moved on.

Don't get your hopes up because the expiration date is close. Most domains renew automatically.

Domains other than .com

Each top-level domain has its own RDAP server. If you don't know which one to ask, rdap.org redirects you to the right one. -L tells curl to follow the redirect.

curl -sL https://rdap.org/domain/manun.dev

Some country domains, such as .kr, may not support RDAP. For those, use the whois command or the national registry's lookup page.

DNS: filtering a long list fast

With lots of candidates, DNS is quicker. Registered domains almost always have NS records, and unregistered ones come back as NXDOMAIN.

for d in manunlab.com manunlog.com manun.dev manun.net; do
  if dig +short NS "$d" | grep -q .; then echo "taken  $d"; else echo "free?  $d"; fi
done

These lookups ran somewhere without dig, so they used Google's DNS-over-HTTPS instead. A Status of 3 in the JSON means NXDOMAIN.

curl -s "https://dns.google/resolve?name=manunlab.com&type=NS"

Don't trust DNS on its own

DNS is only a quick first pass. A domain that's registered but has no nameservers set can still return NXDOMAIN. A domain that just expired may be held by the registrar for a while.

So this was my order: DNS to cut twenty names down to four or five, RDAP to double-check those, and finally the registrar's cart to see the real price. Don't skip the last step. Short or popular names can carry a registry "premium" price, so even a free domain might not cost the usual amount.

Goal How
Filter many candidates quickly DNS NS lookup (dig or dns.google)
Confirm registration status RDAP. 404 means unregistered
Check if it's for sale Aftermarket names in RDAP nameservers
Real price The registrar's checkout page

That's how I landed on manunlab.com. RDAP gave a 404 and Cloudflare sold it to me for $11.17 a year.

Manun

I write down what I learn by building things and breaking them. I build and run this blog on my own, too.

About →