From owner-freebsd-questions@FreeBSD.ORG Sun Nov 4 00:29:08 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D352816A468 for ; Sun, 4 Nov 2007 00:29:08 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from ch-smtp01.sth.basefarm.net (ch-smtp01.sth.basefarm.net [80.76.149.212]) by mx1.freebsd.org (Postfix) with ESMTP id 8FFE013C48D for ; Sun, 4 Nov 2007 00:29:08 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from c83-253-25-183.bredband.comhem.se ([83.253.25.183]:65379 helo=falcon.midgard.homeip.net) by ch-smtp01.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1IoTMF-00009j-3l for freebsd-questions@freebsd.org; Sun, 04 Nov 2007 01:28:55 +0100 Received: (qmail 64421 invoked from network); 4 Nov 2007 01:28:36 +0100 Received: from owl.midgard.homeip.net (10.1.5.7) by falcon.midgard.homeip.net with ESMTP; 4 Nov 2007 01:28:36 +0100 Received: (qmail 1559 invoked by uid 1001); 4 Nov 2007 01:28:36 +0100 Date: Sun, 4 Nov 2007 01:28:36 +0100 From: Erik Trulsson To: deeptech71@gmail.com Message-ID: <20071104002836.GA1526@owl.midgard.homeip.net> Mail-Followup-To: deeptech71@gmail.com, freebsd-questions@freebsd.org References: <472D0E7D.6050209@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <472D0E7D.6050209@gmail.com> User-Agent: Mutt/1.5.16 (2007-06-09) X-Originating-IP: 83.253.25.183 X-Scan-Result: No virus found in message 1IoTMF-00009j-3l. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1IoTMF-00009j-3l 7c5d722e46670f0567cf973138ff590f Cc: freebsd-questions@freebsd.org Subject: Re: reverse grep X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Nov 2007 00:29:08 -0000 On Sun, Nov 04, 2007 at 01:12:45AM +0100, deeptech71@gmail.com wrote: > How is it possible to select lines that do NOT match a specific pattern? By using the '-v' option to grep. > > For example, I'm connecting to 192.168.123.254 via telnet (port 23), and do > tcpdump -nli rl0. This cyclic traffic, becuase when tcpdump outputs > something, the system sends me some packets, which generates output in > tcpdump, and vice versa. I want to filter out packets of telnet access to > the FreeBSD machine, that is, something like: > > tcpdump -nli rl0 | grep --non-matching-lines 192.168.123.254.23 You can also tell tcpdump directly to not generate certain output. E.g. 'tcpdump -nli rl0 not port 23' will not display any traffic to/from port 23. Read the tcpdump(1) manpage for the details - many more options are available. -- Erik Trulsson ertr1013@student.uu.se