linux poison RSS
linux poison Email

Get Hostname from IP address

To get the hostname from the IP address.
The simplest way is to use the “host” utility provided by Gnu/Linux. Just run…

poison:~ # host domain name pointer
poison:~ #

This will query the name server and provide you with the hostname of the IP address.By default it will query the nameserver listed in the /etc/resolv.conf file.


unix find command said...

Many servers doesn't have host command installed on it but you have lot of other choice as well like nslookup, hostname -i etc. See How to find IP address from hostname in linux for more details.

Anonymous said...

also if you are already established connecttion bettwen computer it means you also have arp table required for communication, so just hit arp and you will get hostname for specified ip, also in this way you can see mac of remote host

Anonymous said...

I use two methods.
nslookup | grep name | awk {'print $4'} | sed '$s/\.$//'
host | awk {'print $5'} | sed '$s/\.$//'
to give me hostname only.

Anonymous said...


Anonymous said...

nice sharing

Post a Comment

Related Posts with Thumbnails