From owner-freebsd-questions@FreeBSD.ORG Sun Feb 8 16:49:46 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 782D216A4CE for ; Sun, 8 Feb 2004 16:49:46 -0800 (PST) Received: from hotmail.com (law9-f80.law9.hotmail.com [64.4.9.80]) by mx1.FreeBSD.org (Postfix) with ESMTP id 73EE143D1F for ; Sun, 8 Feb 2004 16:49:46 -0800 (PST) (envelope-from exhausted01@hotmail.com) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Sun, 8 Feb 2004 16:49:46 -0800 Received: from 209.42.38.167 by lw9fd.law9.hotmail.msn.com with HTTP; Mon, 09 Feb 2004 00:49:46 GMT X-Originating-IP: [209.42.38.167] X-Originating-Email: [exhausted01@hotmail.com] X-Sender: exhausted01@hotmail.com From: "yo _" To: freebsd-questions@freebsd.org Date: Sun, 08 Feb 2004 19:49:46 -0500 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 09 Feb 2004 00:49:46.0252 (UTC) FILETIME=[9D0024C0:01C3EEA6] Subject: RE: How to query the computer's ip address? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Feb 2004 00:49:46 -0000 >Hi, > >Silly question, maybe, but is there a simple command to query the >computer's >ip address? Something similar to 'hostname' for finding the computer's >hostname. >I need the four dot-separated ip numbers. > >I can analyze the output of 'ifconfig', but isn't there an easier way. For the sake of looking for a "command" that might do this, i whipped up this long one-liner: ifconfig | perl -nle 'print $1 if(/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/)' note that this will print the first ip address it finds of each line seperated by a newline, so be prepared to handle more than one. -rian _________________________________________________________________ Find great local high-speed Internet access value at the MSN High-Speed Marketplace. http://click.atdmt.com/AVE/go/onm00200360ave/direct/01/