|This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.|
Report process status (POSIX)
ps [-Aa] [-G grouplist] [-o format]... [-p proclist] [-t termlist] [-U userlist]
QNX Neutrino, Microsoft Windows
- Print information for all accessible processes.
- Print information for all processes associated with terminals except for process group leaders.
- -G grouplist
- Write information for processes whose real group ID is given in grouplist. You can delimit the group IDs with commas or spaces.
- -o format
- Write information according to the specifications given in format. If you specify more than one -o option, they're treated as a concatenation of all their format arguments.
- -p proclist
- Print information only for processes whose process IDs are listed in proclist. You can delimit the process IDs with commas or spaces.
- -t termlist
- Print information only for processes associated with the terminals listed in termlist You can delimit the terminal identifiers with commas or spaces.
- -U userlist
- Print information only for processes whose real user ID or login name is given in userlist. You can delimit the user IDs with commas or spaces.
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, you'll probably need to quote 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 the -o 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 -o '%+"PID"p %+"TTY"y %+"TIME"t %+"COMMAND"C'
- Successful completion.
- An error occurred.
Fine-Tuning Your System in the Neutrino User's Guide