Date: Wed, 29 May 2002 06:01:21 -0700 From: "Philip J. Koenig" <pjklist@ekahuna.com> To: questions@FreeBSD.ORG Cc: Roman Neuhauser <neuhauser@bellavista.cz>, Matthias Buelow <mkb@informatik.uni-wuerzburg.de> Subject: ps and console width (was Re: grep and console width) Message-ID: <20020529130119238.AAA493@empty1.ekahuna.com@pc02.ekahuna.com> In-Reply-To: <20020529123732.GE18367@freepuppy.bellavista.cz> References: <20020529121120.GA68681@reiher.informatik.uni-wuerzburg>
next in thread | previous in thread | raw e-mail | index | archive | help
On 29 May 2002, at 14:37, Roman Neuhauser boldly uttered: > > Date: Wed, 29 May 2002 14:11:20 +0200 > > From: Matthias Buelow <mkb@informatik.uni-wuerzburg.de> > > To: "Philip J. Koenig" <pjklist@ekahuna.com> > > Cc: questions@FreeBSD.ORG, Roman Neuhauser <neuhauser@bellavista.cz> > > 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020529130119238.AAA493>