Re: finding the ip address
> 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 ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: finding the ip address
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 ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: finding the ip address
On Sunday 29 August 2004 04:04 pm, 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 > > ___ > [EMAIL PROTECTED] mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "[EMAIL PROTECTED]" Thanks for the info. I modifies your solution slightly, so I could use it for more interfaces easily. ifconfig dc0 | grep inet|awk '{print $2}' ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: finding the ip address
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 ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: finding the ip address
> > I modifies your solution slightly, so I could use it for more interfaces > easily. > > ifconfig dc0 | grep inet|awk '{print $2}' > ___ if your host use DHCP - you may add something to your dhclient.conf and make some script to record it's IP. ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: finding the ip address
> > > Doh! You'd still have to deal with some text output, > though. Sorry. > > KDK host -t A `hostname`|head -1|cut -f 4 -d " " ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"