Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Aug 2004 15:14:13 -0500
From:      "Kevin D. Kinsey, DaleCo, S.P." <kdk@daleco.biz>
To:        "Kevin D. Kinsey, DaleCo, S.P." <kdk@daleco.biz>
Cc:        Steven Friedrich <FreeBSD@InsightBB.com>
Subject:   Re: finding the ip address
Message-ID:  <41323915.7000609@daleco.biz>
In-Reply-To: <413238A9.7060909@daleco.biz>
References:  <200408291538.06836.FreeBSD@InsightBB.com> <003c01c48e03$58827fd0$1200a8c0@gsicomp.on.ca> <413238A9.7060909@daleco.biz>

next in thread | previous in thread | raw e-mail | index | archive | help
Kevin D. Kinsey, DaleCo, S.P. wrote:

> Matt Emmerton wrote:
>
>>> I'm messing with ubermon for superkaramba and I want to know how to 
>>> get my
>>> hosts ip address from the command line (and only the ip address).
>>>
>>> I know I can grep and sed rc.conf or the output of ifconfig, but I'm 
>>> hoping
>>
>>> there's a command like whoami for the ip address.
>>>   
>>
>>
>> There isn't anything that simple, but munging the output of ifconfig 
>> is what
>> you want.  This assumes that your box only has one IP address (other 
>> than
>> localhost):
>>
>> # ifconfig -a | grep "inet " | grep -v 127.0.0.1 | awk ' { print $2 } '
>> 192.168.0.4
>>
>> -- 
>> Matt Emmerton
>>  
>>
> But, for simplicity, if you are on a public host:
>
> $host `hostname`
>
> might do it...
>
> KDK
>
Doh!  You'd still have to deal with some text output,
though.  Sorry.

KDK



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41323915.7000609>