[X-Unix] Re: IP stuff

Timothy Luoma lists at tntluoma.com
Mon Mar 28 22:01:33 PST 2005


On Mar 28, 2005, at 5:31 PM, Mark Philip wrote:

> Hi all, what command can I invoke in Terminal to display my current IP 
> information, DHCP server, gateway information etc? In short, I want to 
> display something similar to what I would get if I were to type 
> 'IPCONFIG /ALL' in the Windows 2000/XP command line.

ifconfig is the closest single command.

gateway =

	netstat -rn -f inet | fgrep default | awk '{print $2}'

on my Powerbook, the wired IP address is 'en0' and the Airport is 
'en1'... you may have to change these to suit your needs

en0 IP address

	ifconfig en0 | tr -d '\012' | fgrep -v inactive | awk '{print $6}'

(change 'en0' to 'en1' to get that instead)

If it is empty, the interface is inactive.

Not sure about DHCP, as I'm not using it in my setup.

TjL




More information about the X-Unix mailing list