I am using the following commands to get the domain name using the IP address
dig -x IPaddress
But it gives me some host names like
ns1 etc. Is there any bash command that can give the actual domain name?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
When I do it I get something like this
dig +short -x $(dig +short example.com)
This is not the original domain name, because the domain name system has no easy way to look it up, as the real name is not registered in the database, however the one that was returned was. It would be to expensive to ask every DNS server in the world.
In addition there is a many to one relationship. Each IP can have many domain names (sometimes a domain name has many IP addresses, used for load balancing).