Small change to 'ps'
Ulrich Spoerlein
uspoerlein at gmail.com
Wed Jan 7 15:49:00 UTC 2009
On Wed, 07.01.2009 at 08:54:41 -0600, Sean C. Farley wrote:
> On Wed, 7 Jan 2009, Ulrich Spoerlein wrote:
>
> > On Tue, 06.01.2009 at 11:52:39 -0800, Sheldon Givens wrote:
> >> Hello everyone,
> >>
> >> It occurs to me that FreeBSD ps lacks the ability to disable header.
> >> This seems like a really obvious feature, and I may have simply
> >> missed it's existence (despite my relentlessly searching the man
> >> page) but here is a small patch that sets the flag 'n' to disable
> >> header output.
> >
> > You've missed it, probably because it is non-obvious:
> >
> > % ps -p 1 -o pid,cpu
> > PID CPU
> > 1 0
> > % ps -p 1 -o pid= -o cpu=
> > 1 0
> > %
>
> Another way:
> ps | tail +2
I'm not sure about the portability of tail +N, I seem to remember that
AIX doesn't support it. Therefore I'd rather use
% ps | sed 1d
which is way more portable.
Cheers,
Ulrich Spoerlein
--
It is better to remain silent and be thought a fool,
than to speak, and remove all doubt.
More information about the freebsd-hackers
mailing list