Usage: sps [select_args] [[-o] fmt_arg] or sps - Sps stands for "sorted ps", and has four main functions: o it runs ps and sorts the output to show parent-child relationships; o it makes it easy to select process trees by pid or regexp pattern; o this help page shows a lot of the useful output format codes; o it knows sensible default arguments for several different OS's. Sps passes most arguments through to ps for processing. However, there are a few special cases. o If the argument -P ppp[,...] is used, it means to show only the branch of the process tree (both ancestors and children) that includes `ppp'. Here, ppp[,...] is interpreted as a pid if ppp is a number; otherwise it is interpreted as a regexp pattern. In the latter case, the pattern is applied to the entire output line from ps. Matched lines are suffixed with " *", and the list of matched pid's is printed at the end of the output. Example: sps -P345,emacs prints the process trees for process 345 and all processes with "emacs" somewhere in the output from ps. The sps exit code will be non-zero no processes match any entries from the ppp,... list. o The argument -q means "quiet". This only affects `-P ppp', in which case only the lines matching ppp are printed, but not the ps header nor the rest of the process tree branch. The summary line at the bottom (with the pid's of the matched processes) is still printed. Another q (`-qq' or `-q -q') increases the quietness: only the summary line of matched pid's is printed. o If the only argument is "-", then stdin is assumed to contain a ps-style output, and sps simply sorts it. o If one or more arguments are of the form ^xxx^yyy, then the arguments are used to edit the default ps command by replacing all occurrances of "xxx" with "yyy". xxx is used as a regexp, so beware of wildcards. The edited command is printed to stderr. (N.B. You can use "^^" to get the default command printed without anything being executed.) o If one argument is "args", it is shorthand for the common use ^comm^args, ie generate the long "args" output (show command with all its arguments) instead of the short "comm" format (show the name of the command being executed). Sps executes ps with the specified select_args, and then sorts the output to show parent-child relationships. The "select_args" are the ps arguments that select which processes are displayed. (The default select_args vary with the OS.) If PID and PPID columns aren't present, the output won't be sorted. For SysV-like ps commands, the additional option [-o] fmt_arg is permitted; the default fmt_arg is "user,pid,ppid,vsz,pcpu,time,comm". Note: to recognize the fmt_arg argument, it must come last and contain a comma. The `-o' is optional. You can override the main select_args and/or the fmt_arg values. If you specify any arguments that start with `-', they are assumed to be select_args, and override the default (yes, sps is smart enough to trim the leading dash from Linux args). If the last argument contains a comma, it is assumed to be a fmt_arg, and overrides the default fmt_arg value. N.B. On SunOS 4.x, ps has rather limited capabilities, and you should not normally override the default options. A non-exhaustive list of useful fmt_arg fields include: user or ruser (effective or real UID) (posix) group or rgroup (effective or real GID) (posix) pid, ppid, pgid (posix) pcpu (% cpu) (posix) vsz (virtual mem size, KB) (posix) nice (posix) etime, stime, time (elapsed, start, and cpu time) (posix) tty (posix) comm, args (argv[0], argv[0..argc-1]) (posix) class, pri (scheduling class, priority) (solaris) osz (main mem image size, pages) (solaris) rss (resident set size, KB) (solaris) pmem (rss, as % of phys memory) (solaris) fname (1st 8 chars of basename of executable file) (solaris) majflt,minflt,pagein (page faults,reclaims,#ops in) (DU) msgrcv,msgsnd,nsignals (#msgs recv'd;# sent; #sigs) (DU) addr,cls,flags,intpri (address, class, flags, priority) (HP-UX) prmid,prmgrp,state (PRM res. gp id, name; state) (HP-UX)