Reputation: 8142
I am writing a bash script that collects information on the LAN to which I am connected.
After following instructions from post How can I write a linux bash script that tells me which computers are ON in my LAN?, I would like to collect some other information on the computers connected on my same LAN, such as their hostname.
I looked in the PING command man page but didn't find anything useful, and also checked NSLOOKUP command, but without success.
Are there any already existing bash commands which resolves IP addresses to hostnames on a private LAN?
In case not, do you have some ideas on how to write a script for getting it?
Upvotes: 0
Views: 1701
Reputation: 150041
You can use dig
:
dig +short -x 64.34.119.12
stackoverflow.com.
Upvotes: 0