The "-g" option can select by session leader OR
by group name. Selection by session leader is specified by
many standards, but selection by group is the logical
behavior that several other operating systems use. This ps
will select by session leader when the list is completely
numeric (as sessions are). Group ID numbers will work only
when some group names are also specified.
The "m" option should not be used. Use
"-m" or "-o" with a list. ("m"
displays memory info, shows threads, or sorts by memory
use)
The "h" option is problematic. Standard BSD ps
uses the option to print a header on each page of output,
but older Linux ps uses the option to totally disable the
header. This version of ps follows the Linux usage of not
printing the header unless the BSD personality has been
selected, in which case it prints a header on each page of
output. Regardless of the current personality, you can use
the long options --headers and --no-headers to enable
printing headers each page and disable headers entirely,
respectively.
Terminals (ttys, or screens of text output) can be
specified in several forms: /dev/ttyS1, ttyS1, S1. Obsolete
"ps t" (your own terminal) and "ps t?"
(processes without a terminal) syntax is supported, but
modern options ("T", "-t" with list,
"x", "t" with list) should be used
instead.
The BSD "O" option can act like "-O"
(user-defined output format with some common fields
predefined) or can be used to specify sort order. Heuristics
are used to determine the behavior of this option. To ensure
that the desired behavior is obtained, specify the other
option (sorting or formatting) in some other way.
For sorting, BSD "O" option syntax is
O[+|-]k1[,[+|-]k2[,...]] Order the process listing according
to the multilevel sort specified by the sequence of short
keys from SORT KEYS, k1, k2, ... The ‘+’ is
quite optional, merely re-iterating the default direction on
a key. ‘-’ reverses direction only on the key it
precedes. The O option must be the last option in a single
command argument, but specifications in successive arguments
are catenated.
GNU sorting syntax is --sortX[+|-]key[,[+|-]key[,...]]
Choose a multi-letter key from the SORT KEYS section. X may
be any convenient separator character. To be GNU-ish use
‘=’. The ‘+’ is really optional
since default direction is increasing numerical or
lexicographic order. For example, ps jax
--sort=uid,-ppid,+pid
This ps works by reading the virtual files in /proc. This
ps does not need to be suid kmem or have any privileges to
run. Do not give this ps any special permissions.
This ps needs access to a namelist file for proper WCHAN
display. The namelist file must match the current Linux
kernel exactly for correct output.
To produce the WCHAN field, ps needs to read the
System.map file created when the kernel is compiled. The
search path is: |