Get domain nameservers from commandline in ubuntu linux

Nameservers of a domain name are those servers that are running a DNS service to provide the ip address of a particular domain name. Along with ip address they provide a lot of other information as well. To check the nameservers of a domain name from the commandline/terminal commands like dig, host etc can be used.

Lets take a few examples

dig

NS records of binarytides.com

$ dig -t ns www.binarytides.com

; <<>> DiG 9.8.1-P1 <<>> -t ns www.binarytides.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20503
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.binarytides.com.           IN      NS

;; ANSWER SECTION:
www.binarytides.com.    13624   IN      CNAME   binarytides.com.
binarytides.com.        80933   IN      NS      omikro2.allwebserver.com.
binarytides.com.        80933   IN      NS      omikro1.allwebserver.com.

;; Query time: 274 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Aug 28 20:29:34 2012
;; MSG SIZE  rcvd: 108

Shorter version

$ dig +short -t ns www.binarytides.com
binarytides.com.
omikro1.allwebserver.com.
omikro2.allwebserver.com.

The t parameter takes the type of record to fetch. It can be ns , a , soa , cname etc. These are the different types of dns records related to a domain name.

host

$ host -t ns www.binarytides.com
www.binarytides.com is an alias for binarytides.com.
binarytides.com name server omikro1.allwebserver.com.
binarytides.com name server omikro2.allwebserver.com.






Last Updated On : 21st November 2012

Subscribe to get updates delivered to your inbox

Leave a comment