From owner-freebsd-questions Wed May 29 6: 1:26 2002 Delivered-To: freebsd-questions@freebsd.org Received: from empty1.ekahuna.com (empty1.ekahuna.com [198.144.200.196]) by hub.freebsd.org (Postfix) with ESMTP id E38C237B403 for ; Wed, 29 May 2002 06:01:19 -0700 (PDT) Received: from pc-02 (pc02.ekahuna.com [198.144.200.197]) by empty1.ekahuna.com (Post.Office MTA v3.5.3 release 223 ID# 0-0U10L2S100V35) with ESMTP id com; Wed, 29 May 2002 06:01:19 -0700 From: "Philip J. Koenig" Organization: The Electric Kahuna Organization To: questions@FreeBSD.ORG Date: Wed, 29 May 2002 06:01:21 -0700 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: ps and console width (was Re: grep and console width) Reply-To: pjklist@ekahuna.com Cc: Roman Neuhauser , Matthias Buelow In-reply-to: <20020529123732.GE18367@freepuppy.bellavista.cz> References: <20020529121120.GA68681@reiher.informatik.uni-wuerzburg> X-mailer: Pegasus Mail for Win32 (v3.12c) Message-ID: <20020529130119238.AAA493@empty1.ekahuna.com@pc02.ekahuna.com> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 29 May 2002, at 14:37, Roman Neuhauser boldly uttered: > > Date: Wed, 29 May 2002 14:11:20 +0200 > > From: Matthias Buelow > > To: "Philip J. Koenig" > > Cc: questions@FreeBSD.ORG, Roman Neuhauser > > Subject: Re: grep and console width > > > > Philip J. Koenig writes: > > > > >> No. It's not grep, it's ps(1). see the w option. > > > > > >Wow, so it is. So even if you redirect the output of that command, > > >and it never even touches a console window, it formats the output to > > >fit the current console window? (or defaults to 80 chars) > > > > Hmm, IMHO ps should only truncate if stdout is a terminal (that's > > the only case where it really makes sense.) The proper Unix way, > > of course, would be to not make grep do any assumptions at all, > > and have a filter command that truncates to screenwidth, although > > that would probably be a bit more effort to use, unless you use > > aliases. We're probably seeing some rather old misdesign here. > > well, grep does *not* make any assumptions. it's really a strange > behavior of ps(1), IOW, I agree with you. Yep. I can only begin to surmise how many times I may have gotten fooled into thinking something wasn't in ps output (using grep) just because ps was truncating its own output. I think I'm going to start getting in the habit of specifying "ps -auxww" instead of "ps -aux" from now on.. (If you only specify one "w", it STILL truncates the output, but this time to 132 instead of 80 columns!) Here's another interesting datapoint. I just tested this on a Caldera Linux 3.1 system. (kernel 2.4, procps 2.0.7) Running either in a console session or in a KDE terminal session that is wide enough to see everything, the same problem occurs. Stranger still, when I don't specify -w, it only returns my grep process. But if I *do* specify -w, it shows the process it missed before, but not the grep process! (Despite this little bit of sanctimonious bashing from the manpage: "Set the I_WANT_A_BROKEN_PS environment variable to force BSD syntax even when options are preceeded by a dash.") Well neener neener. :-) -- Philip J. Koenig pjklist@ekahuna.com Electric Kahuna Systems -- Computers & Communications for the New Millenium To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message