How to install nslookup on Ubuntu

Installing nslookup utility on a Ubuntu 22.04 system.

nslookup is installed by default on most systems, including Windows, MacOS and almost all Linux distros. If it's not or you have uninstalled nslookup by mistake, you can reinstall it.

  1. Update your system package list first:

     $ sudo apt update

    After the update is done, the success message should be:

     Reading package lists... Done
     Building dependency tree... Done
     Reading state information... Done
     62 packages can be upgraded. Run apt list --upgradable to see them.

    nslookup installation on Ubuntu: apt update success message

  2. Install the latest version available of nslookup tool that's available through the dnsutils package:

     $ sudo apt install dnsutils

    If it's already installed, the warning message should be:

     Reading package lists... Done
     Building dependency tree
     Reading state information... Done
     Note, selecting 'bind9-dnsutils' instead of 'dnsutils'
     bind9-dnsutils is already the newest version (1:9.16.1-Qubuntu2).
     bind9-dnsutils set to manually installed.
     0 upgraded, @ newly installed, 0 to remove and 0 not upgraded.

    nslookup installation on Ubuntu: dnsutils is already installed