[mdlug] Some issues with the "ps" command

Robert Meier eaglecoach at wwnet.com
Fri Apr 13 22:13:14 EDT 2007


Ray,

> > Can anyone name a variant of Linux where the following command
> > doesn't work?
> > ps -ae -o pid -o user -o pcpu -o pmem -o args

> ... since I believe all Linux distros went with [POSIX-style] ps a
> long time ago. ...
> Is this going to run on ... any UNIX?

  "-o  format
   Write information according to the format specification given in format.
   This is fully described in the STDOUT section. Multiple -o options can
   be specified; the format specification shall be interpreted as the
   <space>-separated concatenation of all the format option-arguments.
   ...
   ruser ... user ... rgroup ... group ... pid ... ppid ... pgid ...
   pcpu ... vsz ... nice ... time ... tty ... comm ... args ..."
		     -- POSIX.2 (IEEE Std 1003.1: Shell & Utilities: ps)



If you are looking for a portable ps,
   o use multiple '-o's or spaces within a quoted-string for a single -o
   o skip pmem

<IIRC>
I've used comma separation in the past,
and can't remember a system that didn't accept this extension to POSIX.
</IIRC>

SuSE-10.0 extends POSIX.2 by accepting pmem.



Hopefully helpful,
-- 
Dr. Robert J. Meier



More information about the mdlug mailing list