What DNS Servers Am I Using in Linux?

DNS is the “Domain Name System” abbreviation, used for converting particular domain names into IP addresses. For the users, it is hard to remember the IP addresses to search websites. Therefore, the domain name of the IP addresses is defined in the DNS server in order to search websites by name. The user can find the DNS server in Linux using the “resolv.conf” file or built-in utilities such as “dig”, “host”, and “nslookup”.

This post will demonstrate methods to check the DNS server in the Linux operating system:

Method 1: Find DNS Server Through “resolv.conf” File

The first method to retrieve reasonable information about the DNS server is “resolv.conf” file. It is the file that holds the information regarding the IP address of the DNS server located under the directory “/etc/resolv.conf”.

Display the content of the file to get the DNS server information:

$ cat /etc/resolv.conf

The nameserver contains the IP address of the DNS server. But If the nameserver gives the loopback IP address “”, it means the user is using the DNS server locally.

The “” is forwarding the DNS request to the DNS server, the user can run the “resolvectl status” command to see the detail about the current used DNS server:

$ resolvectl status

The DNS server “” is in use.

Method 2: Find DNS Server Through dig Command

The “dig” (Domain Information Groper) is the built-in utility of Linux that is utilized for getting the DNS server information.

The syntax for using the dig utility is given below:


$ dig <website domain>

Type the “dig” command to access any website for displaying the DNS server information.

To get the currently used DNS server information, use the dig with the domain name as follows:

$ dig itslinuxfoss.com

The “” is forwarding the request to the DNS server as explained in Method 1.

Method 3: Find DNS Through nslookup Command

Another method to find the DNS server is by using the “nslookup” utility. It is the built-in utility of Linux that is used for getting the DNS server information. Type any domain name along with the nslookup to find the DNS information.

In our case, the Facebook domain name is used:

$ nslookup facebook.com

The user is currently using the local DNS server

Method 4: Find DNS Server Through Network (GUI)

The user can also find the DNS server information through the GUI method by opening the network settings. For this, open the “Network settings” and then click on the “wired” settings gear icon as shown:

In the “Details” tab, the user can check the DNS server information as shown in the following figure:

The user is using the DNS server


To check the currently used DNS server in Linux, consider the “resolv.conf” file or built-in tools such as ”dig”, and “nslookup” or use the “Network” settings (GUI). Type the “dig” or “nslookup” command along with any domain name to find the DNS server information.

This blog has illustrated the methods to check what DNS server the user is currently using.