Date: Sun, 29 Aug 2004 16:13:10 -0400 From: Steven Friedrich <FreeBSD@InsightBB.com> To: freebsd-questions@freebsd.org Subject: Re: finding the ip address Message-ID: <200408291613.10585.FreeBSD@InsightBB.com> In-Reply-To: <003c01c48e03$58827fd0$1200a8c0@gsicomp.on.ca> References: <200408291538.06836.FreeBSD@InsightBB.com> <003c01c48e03$58827fd0$1200a8c0@gsicomp.on.ca>
next in thread | previous in thread | raw e-mail | index | archive | help
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 > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org" 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}'
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200408291613.10585.FreeBSD>