How to determine the IP addresses of all used DNS servers?

Through the terminal and through the shell file

  • dns-servers on the Internet - a huge amount. please specify your question. You can make changes by clicking edit below question text. - aleksandr barakin
  • 2
    judging by this “answer”, you are interested in the dns server (s) used by your system. see the contents of the file /etc/resolv.conf - aleksandr barakin
  • If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky

1 answer 1

The operating system uses the dns servers listed in the /etc/resolv.conf file as format strings:

 nameserver ip-адрес 

You can view the entire contents of this file, for example, with the command:

 $ cat /etc/resolv.conf 

Only lines beginning with the nameserver (usually not more than three) can be nameserver , for example, as follows:

 $ grep ^nameserver /etc/resolv.conf 

you can display only ip-addresses from such lines, for example, like this:

 $ sed -n 's/^nameserver\s\+//p' /etc/resolv.conf 
  • Ubuntu 15.04, the dnsmasq-base package is installed as a proxy caching, managed by NetworkManager. Your method yields 127.0.1.1, which on the one hand is true, but not the information that I wanted to know. - sercxjo
  • @sercxjo, for your case 127.0.0.1 - this is the answer to this question. and the fact that you probably would like to know - this is a completely different question, which you also need to formulate. - aleksandr barakin