Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a list of IP addresses and MAC addresses connected to my local network, but I need to get the hostnames of each device, is there a command line or terminal (mac) command for this?

share|improve this question
up vote 4 down vote accepted

The command host IP should do it:

jed@jed-osx:~$ host domain name pointer

As Zoredache mentions in the comments, this is not going to work if DNS isn't set up properly. Of course, if that is the case, then you have very limited options. The only method that I can think of is to connect to the IP and ask it what its hostname is (e.g. if you can ssh to it, you can then perform the hostname command to see what it thinks its name is: ssh user@the-ip-address hostname).

share|improve this answer
That presumes that the reverse DNS is setup and updated. If DNS is not setup or maintained then host won't do anything useful. – Zoredache Dec 6 '10 at 21:59
@Zoredache, presumably if DNS is not set up properly, then there won't be any way to get a host's name from its IP. – nhinkle Dec 6 '10 at 22:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .