tags:

views:

141

answers:

4

how to get hostname with IP without logging into the host

+3  A: 

Making a portable wrapper is left as an exercise. :)

unwind
In Java, there's InetAddress.getHostName(). Does that count? :)
Matthew Flaschen
A: 

i am not using it in code. just tell the method . the host is a unix host

+1  A: 

If you're not using it in code (and you're not, according to an answer you posted, which should have really been an edit to your question :-), it's not a programming question.

But the answer is to use nslookup.

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Administrator>nslookup www.company.com
Server:  bhadns01.company.com
Address:  9.190.234.35

Non-authoritative answer:
Name:    www-int.company.com.cs186.net
Address:  129.42.58.216
Aliases:  www.company.com

C:\Documents and Settings\Administrator>nslookup 129.42.58.216
Server:  bhadns01.company.com
Address:  9.190.234.35

Non-authoritative answer:
Name:    www-int.company.com.cs186.net
Address:  129.42.58.216
Aliases:  www.company.com

C:\Documents and Settings\Administrator>
paxdiablo
or do it the other way around: nslookup 9.190.234.35
Zaagmans
Thanks, @Z, I had to edit that bit in since I initially misunderstood the question.
paxdiablo
+2  A: 

nslookup

It's on both Windows and Linux.

ksuralta