How to get the CNAME for a domain?

Tony Finch dot at
Tue Jan 10 11:04:59 UTC 2017

Michelle Konzack <linux4michelle at> wrote:
> OK, I can grep the whole /etc/bind/master/ directory, but since my  Name
> Server is responsable for several 1000 (sub)domains,  the  execution  of
> the script takes ages!

Your approach seems reasonable to me. I'm surprised it takes that long,
unless "several" is 10s or 100s of thousands!

You can make your script tighter, though I would be surprised if it
improves the performance much.

find /etc/bind/master -type f |
egrep -v '(.conf|.signed|.private|.key)$' |
xargs egrep -h "IN CNAME.*${VSERVER}" |
sed 's|\.[ \t]*IN CNAME.*||'

f.anthony.n.finch  <dot at>  -  I xn--zr8h punycode
Forth, Tyne, Dogger, Fisher: West or southwest 5 to 7, increasing gale 8 or
perhaps severe gale 9 later. Moderate or rough, occasionally very rough later.
Rain or showers. Good, occasionally poor.

More information about the bind-users mailing list