I'm looking for a command-line tool that can query a name server for an IP address.

Something like host(1) as provided by BIND.

# query the name server at for the name example.org
$ host example.org

I found Unbound which provides a host(1) replacement but alas, it cannot query custom name servers AFAICT.

I know BIND provides tools that do just that but I would like to avoid those if possible. Bonus points if it is packaged on Debian.

  • 1
    Shipping with most distributions (or at least being available via their repos): dig example.org @ or nslookup example.org – Izzy Oct 21 '16 at 16:40
  • Don't both of those come from BIND? – oals Oct 21 '16 at 17:06
  • Definitely not. I have no bind installed on my workbench, still I have all 3 available. Let me write up an answer. – Izzy Oct 21 '16 at 17:27
  • @Izzy packages.debian.org/jessie/dnsutils "Depends: libbind9-90" – oals Oct 21 '16 at 17:30
  • Yes, see my answer. Same for dig, as they both ship in the same package. But they only require that one library, not the entire bind server package. Is "not depending on bind or its libraries in any way" a requirement for the software you're looking for? You didn't say so :) // PS: Related on Unix&Linux: alternative to nslookup in rhel7? – Izzy Oct 21 '16 at 17:40

You can use getent. See getent --help.

$ getent hosts google.com google.com google.com google.com google.com google.com google.com

Ref: https://unix.stackexchange.com/questions/120710/alternative-to-nslookup-in-rhel7?newreg=df3c1f65191748f8873c294bffad2fde


I haven't tried and don't have Debian box, but there is an alternative to bindutils called ldns which provides a utility called drill that is supposed to work similar to dig. ldnsutils should be available as a debian pacakge and might do what you want.

  • Indeed, I forgot about that one. Package is available on Wheezy and Jessie both, good find! And no dependency on bind libraries listed. Syntax shows it completely meets the requirements: drill [ OPTIONS ] name [ @server ] [ type ] [ class ] :) – Izzy Oct 21 '16 at 18:00

There are multiple solutions available on Linux. Several of them come even pre-installed, but most of them are at least available via the standard repositories. Note that I'm also using the Unbound name server in my local network here :)


This tool ships with the dnsutils package – which in fact is described as Clients provided with BIND, but definitely does not require bind itself (though it uses one of its libraries, libbind). As you requested, it supports an optional parameter to specify which name server to use (by default it checks which one is configured with your system):

nslookup example.org

would request the IP of example.org from a name server listening at port 53 at There's an interactive command-line interface as well, and you can specify which type of address you're looking for – e.g. type=mx for the SMTP MX records of a domain, or type=ns for the name servers.


As nslookup was declared "deprecated" a while ago, today one should use dig. By default, dig produces much more detailed output. The syntax here would be:

dig example.org @

for the same task described above. And again, specifying a name server is optional. Interestingly, the dig tool comes with the very same package, at least on Ubuntu: dnsutils.


This candidate seems to be completely independent from any bind library. It belongs to the djbdns name server which was written from the scratch for exactly the same reasons you're looking after a replacement to bind, and is described e.g. in this article. You can find it in the Ubuntu repositories as udns-utils, the same on Debian Jessie (Wheezy seems not to have it). But unfortunately, dnsip does not support specifying the name server at the command line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.