180

How do I install dig (the DNS lookup tool)? I can't figure out what the package name is.

4
  • 1
    Strange that you don't have it. Package ubuntu-standard directly depends on dnsutils which contains dig, nslookup and nsupdate utilities. Is your system ok? Can you try sudo apt-get install ubuntu-standard?
    – ulidtko
    Feb 7, 2011 at 2:39
  • You appear to have answered your own question?
    – belacqua
    Feb 19, 2011 at 5:41
  • ubuntu servers often do not come with dig Dec 1, 2016 at 22:04
  • It's probably a "minimized" Ubuntu... the only tool left there is pretty much apt (as well as ssh/scp if you've ticked for installing SSH server), not even vi, nano nor ping! From there, the question is to find the names of the packages, dnsutils in this case.
    – Marabiloso
    Dec 19, 2023 at 10:56

3 Answers 3

253

You can install it by opening a terminal and typing

sudo apt-get install dnsutils

Or via the Ubuntu Software Center by clicking bellow:

Install via the software center

For future reference, I found this out by doing a quick search with apt-cache:

apt-cache search dns dig

And then verified with aptitude.

3
  • A much more easier command to determine the package, provided you know complete path of file you are searching is $ sudo dpkg -S /usr/bin/dig dnsutils: /usr/bin/dig
    – Jamess
    Feb 7, 2011 at 4:53
  • 10
    @James, this command will only work if you had dig already installed, while Oli's will search all available packages. Feb 7, 2011 at 8:20
  • 5
    @Jamess You can search by filename on packages.ubuntu.com. And FWIW, you don't need sudo to run dpkg -S.
    – Iain Lane
    Feb 7, 2011 at 9:58
50
sudo apt-get install dnsutils

To find out which package a file is in you can do

sudo apt-cache search dig

Sometimes that works, but in this case it was useless. You can search for which package a specific file is in using the 'Search the contents of packages' search form here:

http://packages.ubuntu.com/

1
  • 1
    As @oli said in their answer, adding keywords can make apt-cache search more useful; in this case the combination of dns and dig keywords returned a much smaller list (about a dozen packages) than either by itself (hundreds for dns, almost a thousand for dig).
    – Mark Reed
    Jun 19, 2017 at 14:38
9

Another command:

apt-file search /usr/bin/dig

You should install apt-file and update it beforehand:

sudo apt-get install apt-file
sudo apt-file update

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .