I want to get the hostname of a remote server using the IP address using my Ubuntu.
In Windows we can get using NBTSTAT but this doesn't work in Linux.
Does anyone know how to do that?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
Windows (and Linux devices with Samba) use NetBIOS to 'publish' their addresses. This is what
NBTSTAT uses to look up the IP address.
To find a hostname in your local network by IP address you can use:
nmblookup -A <ip>
Or you can install
nbtscan by running:
sudo apt-get install nbtscan
If systems publish their address via Multicast DNS (OS X, Windows 10 and Linux devices with a running
avahi-daemon do this), do a lookup using
avahi-resolve (requires installing
avahi-resolve -a <ip>
If the host has a public IP-address and a working reverse DNS entry, use the
dig (requires installing
host (requires installing
dig -x <ip> host <ip>
Simply type the following command into the Linux/Ubuntu terminal:
Just another minor addition to others contribution, in case you don't know the IP.
If you don't know your then type:
sudo ifconfig -all
You may find the there. Then, all you need to do is use the:
command as mentioned before.
Although this is a already answered question, I may found useful add this simple hint to ubuntu-linux newcomers.
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?