Blog Linux Unix

get ip host name in unix and windows

Suppose you have the ip address but need to get the hostname (ip name), you can use the commands below.

Windows


Syntax

nbtstat -a [ip address]


Example

nbtstat -a 10.89.63.12

Output

Local Area Connection:
Node IpAddress: [10.90.76.34] Scope Id: []

NetBIOS Remote Machine Name Table

Name Type Status
---------------------------------------------
BOOMBOOM <00> UNIQUE Registered
RICOMAMBO <00> GROUP Registered
BOOMBOOM <20> UNIQUE Registered
RICOMAMBO <1E> GROUP Registered

MAC Address = 0A-40-57-C8-51-31

Linux/Unix


Syntax


nslookup [ip address]


Example


rico700 @ ricousr:[/home/rico] #nslookup 10.89.63.12
Using /etc/hosts on: chismoso

looking up FILES
Trying DNS
Name: boomboom.ricomambo.com
Address: 10.89.63.12

I'd like to add that you can also use nslookup in getting the ip address by using the domain name as the input. This is applicable for Windows and Unix/Linux machines.

Syntax

nslookup [domain name|hostname]

Example

rico700 @ ricousr:[/home/rico] #nslookup boomboom.ricomambo.com
Using /etc/hosts on: chismoso

looking up FILES
Trying DNS
Name: boomboom.ricomambo.com
Address: 10.89.63.12