[olug] Unix Tip: GETTING IPs FROM IFCONFIG
    Matthew G. Marsh 
    mgm at midwestlinux.com
       
    Mon Jan 20 15:46:30 UTC 2003
    
    
  
> GETTING IPs FROM IFCONFIG
>
> You can use ifconfig to lookup
> IP addresses bound to your box.
> If you do not want to search the
> output from ifconfig, use the
> following command to get just
> the IP listing.
>
> ifconfig | awk '/inet/{print $2}' | awk -F: '{print $2}'
For those of you on DHCP using the DHClient from ISC :
`grep -a -m 1 fixed /var/state/dhcp/dhclient.leases | awk '{print $2}' \
	 | cut -d \; -f 1`
Make sure it is all on one line though...
--------------------------------------------------
Matthew G. Marsh,  President
Paktronix Systems LLC
1506 North 59th Street
Omaha  NE  68104
Phone: (402) 932-7250
Email: mgm at midwestlinux.com
WWW:  http://www.midwestlinux.com
--------------------------------------------------
    
    
More information about the OLUG
mailing list