# [solved] commandline ip from domainname

## yaverot

I'm certain many of you will find this a stupid question, but I'm trying to resolve a domain name to IP at the command line.  Mainly I want to do this so I can automate updating dtdns of my current IP.

Google et al tell me that the command is nslookup.  But that command doesn't exist, okay, so maybe that's the command under RedHat or Debian.  Further digging says: host.  Nope that doesn't exist either.  dig? Also no.  I did even more digging, and came across a reference to dnsip. Another "command not found".

Okay, obvously the system resolves names into IPs and has done so consistently under Gentoo since 2007.  So what's the Gentoo command that gives you the IP from the domain name?

I'm really hoping for a better answer than ping.

Edit:

It seams weird to have to emerge another package to merely do a subset of what ping already does, and then have to go through these gyrations to get the information cleanly, but since I've done the work; here's how to do it:

```
ping -c 1 example.com | grep PING | awk '{print $3}' | sed -e s/\(// -e s/\)// 
```

Last edited by yaverot on Fri Jul 09, 2010 1:16 pm; edited 1 time in total

----------

## Ant P.

emerge net-dns/bind-tools

----------

## Hu

To elaborate on the answer given by Ant_P, all of nslookup, host, and dig are valid answers to the question.  You do not have them because you have not installed the package which provides them.  Some systems work fine without any of those tools, so they are not considered a mandatory part of the base install.  As it happens, the package net-dns/bind-tools provides all three of these tools.

----------

## madchaz

or you could just ping the address and check what IP it returns

----------

