[PLUG] getting IP address of host
Paul Heinlein
heinlein at madboa.com
Wed Apr 30 18:07:13 UTC 2008
On Wed, 30 Apr 2008, Wil Cooley wrote:
>> ip addr show eth0 | awk '/inet / {print $2}' | cut -d/ -f1
>>
>
> Even better would be to choose the interface that is the default
> gateway:
>
> ip route ls|awk '/^default/ {print $5}'|xargs ip addr show|awk '/inet / {print $2}' | cut -d/ -f1
<we're-not-worthy-bow/> Sweet!
--
Paul "pipes are my friends" Heinlein
More information about the PLUG
mailing list