QNX Community Resources
Report process status (POSIX)
- Print information for all accessible processes.
- Print information for all processes associated with terminals except for process group leaders.
- (QNX extension) Print information for all processes except process group leaders.
- (QNX extension) Print in long format showing elapsed time (equivalent to -F "%p %r %N %S %b %T %a").
- -F format
- (QNX extension) Print information according to the format specifications given in format.
- -G grouplist
- Not supported in QNX 4.24. See -g.
- [-g gid[,gid]...
- (QNX extension) Print information only for processes whose group IDs are listed.
- ("el" -- QNX extension) Print in long format (equivalent to -F "%p %r %N %S %b %x %a").
- -n node
- (QNX extension) Print information only for processes on the specified node.
- -o format
- Not supported in QNX 4.24. See -F.
- -p pid[,pid]...
- Print information only for processes whose process IDs are listed.
- -s sid[,sid]...
- (QNX extension) Print information only for processes whose session IDs are listed.
- -S state[,state]...
- (QNX extension) Print information only for processes whose states are listed. (e.g. READY, WAIT).
- -t sid[,sid]...
- Print information only for processes associated with the terminals listed. Terminals must be in the form [nid]tty_basename, where nid is the node the device exists on, and tty_basename is the basename portion of the controlling terminal's pathname. (e.g. con1 for //3/dev/con1)
- -U userlist
- Not supported in QNX 4.24. See -u.
- -u uid[,uid]...
- (QNX extension) Print information only for processes whose user IDs are listed.
The ps utility prints information about processes, subject to having the appropriate privilege to obtain information about those processes. With no options, ps prints information about processes associated with the current terminal. The output includes the process ID, terminal name, cumulative execution time, and command name of each process.
The options that use lists (-g, -p, -t, -u) can list multiple items separated by commas or white space, as long as all the items are contained within a single command-line argument. If white space is used, this will require quoting the list when invoking ps from the shell.
The initial set of processes selected by -a, -A, or -d is intersected with the processes selected by the -g, -p, -t, or -u options, if any of the latter are specified.
If none of -a, -A, or -d is specified, ps behaves as though you specified -u your_uid.
To control the content and format of output, you use -F format option, which takes any of the field descriptors listed below. All of these field descriptors, with the exception of %% and %a, are of the form:
The + forces right justification; the - forces left justification. If neither + nor - is specified, the default justification for the descriptor is used. If no title is given for a field, spaces are printed. The [ and ] aren't part of the descriptor; they simply show the optional parts of the descriptor.
The %a field descriptor has the form:
You can use the optional width for limiting the length of what is printed for this field.
Any text included between the field descriptors is printed on all lines, including the header line.
- A literal % character.
- The command with all its arguments as a string.
- The process that this process is blocked on.
- The name of the command (argv value) as a string.
- The ratio of CPU time used (%x) to CPU time available, expressed as a percentage.
- The current working directory of the process.
- The initial environment of the process.
- The flags of the process.
- The real group ID of the process.
- The effective group ID of the process.
- The decimal value of the process ID.
- The decimal value of the parent process ID.
- The decimal value of the process's nice value.
- The decimal value of the process's priority.
- The decimal value of the process group ID.
- The decimal value of the session ID.
- The process state of the process.
- In the POSIX locale, the elapsed wall clock time of the process
in the form:
The dd field is not shown if less than one day.
- In the POSIX locale, the relative start time of the process in the form:
- The real user ID of the process. If the user ID is present in the /etc/passwd file, a textual user name is printed; otherwise, a decimal numeric user ID is printed.
- The effective user ID of the process (see %u).
- In the POSIX locale, the cumulative CPU time
of the process in the form:
- If a controlling terminal is present, the name of the terminal, consisting of the node ID followed by the basename of the device pathname.
- The size of the process in (virtual) memory in kilobytes, expressed as a decimal integer. Shared code or segments are not accounted for.
Emulate the default output from a System V ps command:
ps -F '%+"PID"p %+"TTY"y %+"TIME"t %+"COMMAND"C'
- Successful completion.
- An error occurred.