How to find a website’s DNS (name server) address

How can I find a website’s DNS address? How do I check the current DNS servers of a domain or website using a Linux or macOS command line option? How do I find DNS address of a website using bash?

DNS stands for “Domain Name System“. The DNS is a naming system for computers, servers and other network devices over the Internet. DNS is created for us to translate human-friendly computer names into IP addresses. This page shows how to use Linux, *BSD, macOS, and Unix command dig or host to find DNS addresses and names.

How to find a website’s DNS address

To check the current nameservers (DNS) for any domain name from a Linux or Unix/macOS command line:

  1. Open the Terminal application
  2. Type host -t ns domain-name-com-here to print the current DNS servers of a domain.
  3. Another options is to run dig ns your-domain-name command.
  4. To find the delegation path from the root name servers, try: dig +trace your-domain-name
  5. Above Linux or Unix, commands will show you detailed information about the domain name, including its nameserver (DNS).

Let us see all commands and examples in details.

Check the current DNS servers of a domain

Do you need to find the DNS address of a website called from the command line? Simply type the following dig command:
dig ns website-domain
dig ns
dig ns

The default is to print the answer in a verbose format. However, one can get a terse answer by passing the +short as follows:
dig +short ns
Sample outputs:

One can use the same commands to print actual IP address of name servers:
dig +short a
dig +short aaaa

How to look for the delegation path from the root DNS/name servers

Tracing is disabled by default. When tracing is enabled, dig makes iterative queries to resolve the name being looked up. It will follow referrals from the root servers, showing the answer from each server that was used to resolve the lookup. If @server is also specified, it affects only the initial query for the root zone name servers. For example:
dig +trace
dig +trace @

Sample outputs:

; <<>> DiG 9.11.4-P2-RedHat-9.11.4-9.P2.el7 <<>> +trace @
;; global options: +cmd
.			7313	IN	NS
.			7313	IN	NS
.			7313	IN	NS
.			7313	IN	NS
.			7313	IN	NS
.			7313	IN	NS
.			7313	IN	NS
.			7313	IN	NS
.			7313	IN	NS
.			7313	IN	NS
.			7313	IN	NS
.			7313	IN	NS
.			7313	IN	NS
.			7313	IN	RRSIG	NS 8 0 518400 20191115050000 20191102040000 22545 . Z14B+vD/MKz0X1UBwu04kzwQNajhg1AflK7j5Jvd9NZac1HZ/M9xdSGN F85s/5ITxEiWWeiBhRghy9PkdOmN3ZzhzS5E8ZeIibm0DdIse+qlPNas sfmNZEsIRbXEOER98eQ+Ieb0hjOlu7Y5l6Mo3dnuyE203IxXZTmtD9QH zMRbX8gOrBnee1XYe7kxw+S2AN6BBeRHNFPHuT5nBCwWQlDVFao2ICrV 0oU97YJE7fwDNzyBgb89G++GjVKhQoM/0Bmr4D2vUAqCz7Nt9Gb28TOt A+FpA6Ax9MpjZSCH8dOvz1nytjWfRMYyF5LVGEN6oPW6BKX2fWrfhIC4 TWIfWA==
;; Received 525 bytes from in 7 ms
biz.			172800	IN	NS
biz.			172800	IN	NS
biz.			172800	IN	NS
biz.			172800	IN	NS
biz.			172800	IN	NS
biz.			172800	IN	NS
biz.			86400	IN	DS	12385 8 2 AE03B95863B999FC84B725DF5C903511FF96D53825F0454CE6880987 E96F5D20
biz.			86400	IN	DS	12385 8 1 E917523077754FB03308402D76144EAF0D4F6778
biz.			86400	IN	DS	28450 8 1 D9C2F912C657E4005CF0C13BA55C5AAA291AEF56
biz.			86400	IN	DS	28450 8 2 403F234609C56B3A221BC4CFB694948AB5DDF4A26AE17439BF1279CF C5CF21AB
biz.			86400	IN	RRSIG	DS 8 1 86400 20191116050000 20191103040000 22545 . i3J7qFB7/r4bUrZgZg8OcjcfguFXlSWJbgSzWJyFb+04qKWOFks4HwI9 uYKbr35anabpF2DfHlwKurmO/0HN/7uRC5da5VPMild2gUiJmXKjcN73 Gx/8F3zo3fVAjNxi+/JWicUgpCAY4iKfDq21YNV1CZopAn7QPw3+OUoo Haewp4MEF0T+omyMirn1RxBbK6+P2FNFxgGysJsUUNt1yz7Ax2tR/otY DllMPu6sLhY8MvThBVXmZCrpVTXmd/+VUlim8m/BUz/E7fumnrrraFam Khf3skCrfuLlHgemOz/pugUx8qnJ3BtsQKQzsL2cAY34I3g0kA7ckC6c moAEFA==
;; Received 778 bytes from in 191 ms		7200	IN	NS		7200	IN	NS 86400 IN NSEC3 1 1 1 E3C15F5F 9J0FSB5H124LGRSLHHGR0RDCP0RTEF1N NS SOA RRSIG DNSKEY NSEC3PARAM 86400 IN RRSIG NSEC3 8 2 86400 20191203045447 20191103042210 24963 biz. wkpoTyfFje28GBCJSTzgpV3Cr0Kbknw0n+WTv8/CpXUxG5CiKAfb2qmA KRClCT5oBelSA0FE1GekCjiEWFStCrnW2JOsLsSNWA3QKf8oWPhtBjLq Ij1+YEBFDVC67b0Kdeg6ndM3OZVlb7q9Xvi3n1PIUHS3fbuNF1MyYqMu V10e1Zfn8elyC4fEtJ6YmUhsm4oxHKkhk1NIUG8FQNg0YQ== 86400 IN NSEC3 1 1 1 E3C15F5F 91U8FRHJGMNHK5TPH2253L6LFIU8HM5A NS DS RRSIG 86400 IN RRSIG NSEC3 8 2 86400 20191127183100 20191028181200 24963 biz. YbrRM0lxpgF4rhRe4rfDAMrRq4ifiM9MkIlPuV0XYEY9NpyUNAc19xoi MRqbyUl56YlKiIlrhZPzUedDdkObt3Zz4mXI5tz5DhNPE6t4l4tNEjzH hnagx8TeCLI19S3GBE3tFzlF5zC/1ccOrl2bkYIMBHXssLkJwEGaqX9B VTRGAS1JDOxE0bXG2iEZtWotzu3Jgv+zeXG0HnCALyLFmQ==
;; Received 653 bytes from in 30 ms		300	IN	A		300	IN	A
;; Received 74 bytes from in 65 ms

Find DNS address of a website using host command

The syntax is as follows for the host command:
host -t ns domain-name-here
host -t ns
host -t ns

Sample outputs: name server name server

Again use host to display IP address for nameserver:
host -t a has address
host -t aaaa has IPv6 address 2400:cb00:2049:1::adf5:3b58

A note about Windows users

You can use the nslookup command to show information about Domain Name System (DNS) infrastructure on Windows desktop or server. Go to Start and type cmd in search field to open the command prompt. Type nslookup and hit Enter as follows:
nslookup domain-name

Sample outputs:


Non-authoritative answer:
Address: 2606:4700:10::6814:bb05
Address: 2606:4700:10::6814:ba05

Of course one print ns type as follows:
> set q=ns

A list of DNS record types

Commonly used record types Description Examples
A Host address host -t a
AAAA IPv6 host address host -t aaaa
ALIAS Auto resolved alias host -t alias
CNAME Canonical name for an alias host -t cname
MX Mail eXchange host -t mx
NS Name Server host -t ns
PTR Pointer host -t ptr
SOA Start Of Authority host -t soa
SRV Location of service host -t srv
TXT Descriptive text host -t txt

You can use record types with nslookup, dig and host commands as follows:
$ host -t TYPE domain-name-here
$ dig TYPE domain-name-here
$ nslookup
> set q=TYPE
> dommain-name-here


You learned how to use dig, nslookup, and host commands to find information that you can use to diagnose Domain Name System (DNS) infrastructure, including mx, ns, and other records for a given website or DNS address.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 1 comment so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

Comments on this entry are closed.

Comments are closed. Still have questions? Post it on our forum