862 lines
30 KiB
HTML
862 lines
30 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
|
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
|
<title>ps</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3"> <a name="ps"></a> <a name="tag_04_104"></a><!-- ps -->
|
|
<!--header start-->
|
|
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
|
IEEE Std 1003.1-2001<br>
|
|
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
|
|
|
<!--header end-->
|
|
<hr size="2" noshade>
|
|
<h4><a name="tag_04_104_01"></a>NAME</h4>
|
|
|
|
<blockquote>ps - report process status</blockquote>
|
|
|
|
<h4><a name="tag_04_104_02"></a>SYNOPSIS</h4>
|
|
|
|
<blockquote class="synopsis">
|
|
<div class="box"><code><tt><sup>[<a href="javascript:open_code('UP XSI')">UP XSI</a>]</sup> <img src="../images/opt-start.gif" alt=
|
|
"[Option Start]" border="0"> ps</tt> <b>[</b><tt>-aA</tt><b>][</b><tt>-defl</tt><b>][</b><tt>-G</tt>
|
|
<i>grouplist</i><b>][</b><tt>-o</tt> <i>format</i><b>]</b><tt>...</tt><b>[</b><tt>-p</tt> <i>proclist</i><b>][</b><tt>-t</tt>
|
|
<i>termlist</i><b>]<br>
|
|
<br>
|
|
[</b><tt>-U</tt> <i>userlist</i><b>][</b><tt>-g</tt> <i>grouplist</i><b>][</b><tt>-n</tt> <i>namelist</i><b>][</b><tt>-u</tt>
|
|
<i>userlist</i><b>]</b><tt><img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div>
|
|
|
|
<tt><br>
|
|
</tt></blockquote>
|
|
|
|
<h4><a name="tag_04_104_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>ps</i> utility shall write information about processes, subject to having the appropriate privileges to obtain
|
|
information about those processes.</p>
|
|
|
|
<p>By default, <i>ps</i> shall select all processes with the same effective user ID as the current user and the same controlling
|
|
terminal as the invoker.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_104_04"></a>OPTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>ps</i> utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, <a href=
|
|
"../basedefs/xbd_chap12.html#tag_12_02">Section 12.2, Utility Syntax Guidelines</a>.</p>
|
|
|
|
<p>The following options shall be supported:</p>
|
|
|
|
<dl compact>
|
|
<dt><b>-a</b></dt>
|
|
|
|
<dd>Write information for all processes associated with terminals. Implementations may omit session leaders from this list.</dd>
|
|
|
|
<dt><b>-A</b></dt>
|
|
|
|
<dd>Write information for all processes.</dd>
|
|
|
|
<dt><b>-d</b></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Write information for all processes, except session leaders. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
|
|
|
<dt><b>-e</b></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Write information for all processes. <img src="../images/opt-end.gif" alt="[Option End]" border="0"> (Equivalent to
|
|
<b>-A</b>.)</dd>
|
|
|
|
<dt><b>-f</b></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Generate a <b>full</b> listing. (See the STDOUT section for the contents of a <b>full</b> listing.) <img src=
|
|
"../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
|
|
|
<dt><b>-g </b> <i>grouplist</i></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Write information for processes whose session leaders are given in <i>grouplist</i>. The application shall ensure that the
|
|
<i>grouplist</i> is a single argument in the form of a <blank> or comma-separated list. <img src="../images/opt-end.gif" alt=
|
|
"[Option End]" border="0"></dd>
|
|
|
|
<dt><b>-G </b> <i>grouplist</i></dt>
|
|
|
|
<dd>Write information for processes whose real group ID numbers are given in <i>grouplist</i>. The application shall ensure that
|
|
the <i>grouplist</i> is a single argument in the form of a <blank> or comma-separated list.</dd>
|
|
|
|
<dt><b>-l</b></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Generate a <b>long</b> listing. (See STDOUT for the contents of a <b>long</b> listing.) <img src="../images/opt-end.gif" alt=
|
|
"[Option End]" border="0"></dd>
|
|
|
|
<dt><b>-n </b> <i>namelist</i></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Specify the name of an alternative system <i>namelist</i> file in place of the default. The name of the default file and the format
|
|
of a <i>namelist</i> file are unspecified. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
|
|
|
<dt><b>-o </b> <i>format</i></dt>
|
|
|
|
<dd>Write information according to the format specification given in <i>format</i>. This is fully described in the STDOUT section.
|
|
Multiple <b>-o</b> options can be specified; the format specification shall be interpreted as the <space>-separated
|
|
concatenation of all the <i>format</i> option-arguments.</dd>
|
|
|
|
<dt><b>-p </b> <i>proclist</i></dt>
|
|
|
|
<dd>Write information for processes whose process ID numbers are given in <i>proclist</i>. The application shall ensure that the
|
|
<i>proclist</i> is a single argument in the form of a <blank> or comma-separated list.</dd>
|
|
|
|
<dt><b>-t </b> <i>termlist</i></dt>
|
|
|
|
<dd>Write information for processes associated with terminals given in <i>termlist</i>. The application shall ensure that the
|
|
<i>termlist</i> is a single argument in the form of a <blank> or comma-separated list. Terminal identifiers shall be given in
|
|
an implementation-defined format. <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif"
|
|
alt="[Option Start]" border="0"> On XSI-conformant systems, they shall be given in one of two forms: the device's filename
|
|
(for example, <b>tty04</b>) or, if the device's filename starts with <b>tty</b>, just the identifier following the characters
|
|
<b>tty</b> (for example, <tt>"04"</tt> ). <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
|
|
|
<dt><b>-u </b> <i>userlist</i></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Write information for processes whose user ID numbers or login names are given in <i>userlist</i>. The application shall ensure
|
|
that the <i>userlist</i> is a single argument in the form of a <blank> or comma-separated list. In the listing, the numerical
|
|
user ID shall be written unless the <b>-f</b> option is used, in which case the login name shall be written. <img src=
|
|
"../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
|
|
|
<dt><b>-U </b> <i>userlist</i></dt>
|
|
|
|
<dd>Write information for processes whose real user ID numbers or login names are given in <i>userlist</i>. The application shall
|
|
ensure that the <i>userlist</i> is a single argument in the form of a <blank> or comma-separated list.</dd>
|
|
</dl>
|
|
|
|
<p>With the exception of <b>-o</b> <i>format</i>, all of the options shown are used to select processes. If any are specified, the
|
|
default list shall be ignored and <i>ps</i> shall select the processes represented by the inclusive OR of all the
|
|
selection-criteria options.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_104_05"></a>OPERANDS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_104_06"></a>STDIN</h4>
|
|
|
|
<blockquote>
|
|
<p>Not used.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_104_07"></a>INPUT FILES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_104_08"></a>ENVIRONMENT VARIABLES</h4>
|
|
|
|
<blockquote>
|
|
<p>The following environment variables shall affect the execution of <i>ps</i>:</p>
|
|
|
|
<dl compact>
|
|
<dt><i>COLUMNS</i></dt>
|
|
|
|
<dd>Override the system-selected horizontal display line size, used to determine the number of text columns to display. See the
|
|
Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap08.html">Chapter 8, Environment
|
|
Variables</a> for valid values and results when it is unset or null.</dd>
|
|
|
|
<dt><i>LANG</i></dt>
|
|
|
|
<dd>Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of
|
|
IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap08.html#tag_08_02">Section 8.2, Internationalization Variables</a> for
|
|
the precedence of internationalization variables used to determine the values of locale categories.)</dd>
|
|
|
|
<dt><i>LC_ALL</i></dt>
|
|
|
|
<dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd>
|
|
|
|
<dt><i>LC_CTYPE</i></dt>
|
|
|
|
<dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as
|
|
opposed to multi-byte characters in arguments).</dd>
|
|
|
|
<dt><i>LC_MESSAGES</i></dt>
|
|
|
|
<dd>Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error and
|
|
informative messages written to standard output.</dd>
|
|
|
|
<dt><i>LC_TIME</i></dt>
|
|
|
|
<dd>Determine the format and contents of the date and time strings displayed.</dd>
|
|
|
|
<dt><i>NLSPATH</i></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Determine the location of message catalogs for the processing of <i>LC_MESSAGES .</i> <img src="../images/opt-end.gif" alt=
|
|
"[Option End]" border="0"></dd>
|
|
|
|
<dt><i>TZ</i></dt>
|
|
|
|
<dd>Determine the timezone used to calculate date and time strings displayed. If <i>TZ</i> is unset or null, an unspecified default
|
|
timezone shall be used.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_104_09"></a>ASYNCHRONOUS EVENTS</h4>
|
|
|
|
<blockquote>
|
|
<p>Default.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_104_10"></a>STDOUT</h4>
|
|
|
|
<blockquote>
|
|
<p>When the <b>-o</b> option is not specified, the standard output format is unspecified.</p>
|
|
|
|
<p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
On XSI-conformant systems, the output format shall be as follows. The column headings and descriptions of the columns in a
|
|
<i>ps</i> listing are given below. The precise meanings of these fields are implementation-defined. The letters <tt>'f'</tt> and
|
|
<tt>'l'</tt> (below) indicate the option ( <b>full</b> or <b>long</b>) that shall cause the corresponding heading to appear;
|
|
<b>all</b> means that the heading always appears. Note that these two options determine only what information is provided for a
|
|
process; they do not determine which processes are listed.</p>
|
|
|
|
<table cellpadding="3">
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>F</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">(l)</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Flags (octal and additive) associated with the process.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>S</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">(l)</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">The state of the process.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>UID</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">(f,l)</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">The user ID number of the process owner; the login name is printed under the <b>-f</b> option.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>PID</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">(all)</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">The process ID of the process; it is possible to kill a process if this datum is known.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>PPID</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">(f,l)</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">The process ID of the parent process.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>C</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">(f,l)</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Processor utilization for scheduling.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>PRI</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">(l)</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">The priority of the process; higher numbers mean lower priority.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>NI</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">(l)</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Nice value; used in priority computation.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>ADDR</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">(l)</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">The address of the process.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>SZ</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">(l)</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">The size in blocks of the core image of the process.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>WCHAN</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">(l)</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">The event for which the process is waiting or sleeping; if blank, the process is running.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>STIME</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">(f)</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Starting time of the process.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>TTY</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">(all)</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">The controlling terminal for the process.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>TIME</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">(all)</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">The cumulative execution time for the process.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>CMD</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">(all)</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">The command name; the full command name and its arguments are written under the <b>-f</b> option.</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p>A process that has exited and has a parent, but has not yet been waited for by the parent, shall be marked <b>defunct</b>.</p>
|
|
|
|
<p>Under the option <b>-f</b>, <i>ps</i> tries to determine the command name and arguments given when the process was created by
|
|
examining memory or the swap area. Failing this, the command name, as it would appear without the option <b>-f</b>, is written in
|
|
square brackets. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
|
|
|
|
<p>The <b>-o</b> option allows the output format to be specified under user control.</p>
|
|
|
|
<p>The application shall ensure that the format specification is a list of names presented as a single argument, <blank> or
|
|
comma-separated. Each variable has a default header. The default header can be overridden by appending an equals sign and the new
|
|
text of the header. The rest of the characters in the argument shall be used as the header text. The fields specified shall be
|
|
written in the order specified on the command line, and should be arranged in columns in the output. The field widths shall be
|
|
selected by the system to be at least as wide as the header text (default or overridden value). If the header text is null, such as
|
|
<b>-o</b> <i>user</i>=, the field width shall be at least as wide as the default header text. If all header text fields are null,
|
|
no header line shall be written.</p>
|
|
|
|
<p>The following names are recognized in the POSIX locale:</p>
|
|
|
|
<dl compact>
|
|
<dt><b>ruser</b></dt>
|
|
|
|
<dd>The real user ID of the process. This shall be the textual user ID, if it can be obtained and the field width permits, or a
|
|
decimal representation otherwise.</dd>
|
|
|
|
<dt><b>user</b></dt>
|
|
|
|
<dd>The effective user ID of the process. This shall be the textual user ID, if it can be obtained and the field width permits, or
|
|
a decimal representation otherwise.</dd>
|
|
|
|
<dt><b>rgroup</b></dt>
|
|
|
|
<dd>The real group ID of the process. This shall be the textual group ID, if it can be obtained and the field width permits, or a
|
|
decimal representation otherwise.</dd>
|
|
|
|
<dt><b>group</b></dt>
|
|
|
|
<dd>The effective group ID of the process. This shall be the textual group ID, if it can be obtained and the field width permits,
|
|
or a decimal representation otherwise.</dd>
|
|
|
|
<dt><b>pid</b></dt>
|
|
|
|
<dd>The decimal value of the process ID.</dd>
|
|
|
|
<dt><b>ppid</b></dt>
|
|
|
|
<dd>The decimal value of the parent process ID.</dd>
|
|
|
|
<dt><b>pgid</b></dt>
|
|
|
|
<dd>The decimal value of the process group ID.</dd>
|
|
|
|
<dt><b>pcpu</b></dt>
|
|
|
|
<dd>The ratio of CPU time used recently to CPU time available in the same period, expressed as a percentage. The meaning of
|
|
"recently" in this context is unspecified. The CPU time available is determined in an unspecified manner.</dd>
|
|
|
|
<dt><b>vsz</b></dt>
|
|
|
|
<dd>The size of the process in (virtual) memory in 1024 byte units as a decimal integer.</dd>
|
|
|
|
<dt><b>nice</b></dt>
|
|
|
|
<dd>The decimal value of the nice value of the process; see <a href="nice.html"><i>nice</i>()</a> .</dd>
|
|
|
|
<dt><b>etime</b></dt>
|
|
|
|
<dd>In the POSIX locale, the elapsed time since the process was started, in the form:
|
|
|
|
<pre>
|
|
<b>[[</b><i>dd</i><tt>-</tt><b>]</b><i>hh</i><tt>:</tt><b>]</b><i>mm</i><tt>:</tt><i>ss</i>
|
|
</pre>
|
|
|
|
<p>where <i>dd</i> shall represent the number of days, <i>hh</i> the number of hours, <i>mm</i> the number of minutes, and
|
|
<i>ss</i> the number of seconds. The <i>dd</i> field shall be a decimal integer. The <i>hh</i>, <i>mm</i>, and <i>ss</i> fields
|
|
shall be two-digit decimal integers padded on the left with zeros.</p>
|
|
</dd>
|
|
|
|
<dt><b>time</b></dt>
|
|
|
|
<dd>In the POSIX locale, the cumulative CPU time of the process in the form:
|
|
|
|
<pre>
|
|
<b>[</b><i>dd</i><tt>-</tt><b>]</b><i>hh</i><tt>:</tt><i>mm</i><tt>:</tt><i>ss</i>
|
|
</pre>
|
|
|
|
<p>The <i>dd</i>, <i>hh</i>, <i>mm</i>, and <i>ss</i> fields shall be as described in the <b>etime</b> specifier.</p>
|
|
</dd>
|
|
|
|
<dt><b>tty</b></dt>
|
|
|
|
<dd>The name of the controlling terminal of the process (if any) in the same format used by the <a href=
|
|
"../utilities/who.html"><i>who</i></a> utility.</dd>
|
|
|
|
<dt><b>comm</b></dt>
|
|
|
|
<dd>The name of the command being executed ( <i>argv</i>[0] value) as a string.</dd>
|
|
|
|
<dt><b>args</b></dt>
|
|
|
|
<dd>The command with all its arguments as a string. The implementation may truncate this value to the field width; it is
|
|
implementation-defined whether any further truncation occurs. It is unspecified whether the string represented is a version of the
|
|
argument list as it was passed to the command when it started, or is a version of the arguments as they may have been modified by
|
|
the application. Applications cannot depend on being able to modify their argument list and having that modification be reflected
|
|
in the output of <i>ps</i>.</dd>
|
|
</dl>
|
|
|
|
<p>Any field need not be meaningful in all implementations. In such a case a hyphen ( <tt>'-'</tt> ) should be output in place of
|
|
the field value.</p>
|
|
|
|
<p>Only <b>comm</b> and <b>args</b> shall be allowed to contain <blank>s; all others shall not. Any implementation-defined
|
|
variables shall be specified in the system documentation along with the default header and indicating whether the field may contain
|
|
<blank>s.</p>
|
|
|
|
<p>The following table specifies the default header to be used in the POSIX locale corresponding to each format specifier.<br>
|
|
</p>
|
|
|
|
<center><b>Table: Variable Names and Default Headers in <i>ps</i></b></center>
|
|
|
|
<center>
|
|
<table border="1" cellpadding="3" align="center">
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b>Format Specifier</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Default Header</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Format Specifier</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Default Header</b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>args</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>COMMAND</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>ppid</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>PPID</b></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>comm</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>COMMAND</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>rgroup</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>RGROUP</b></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>etime</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>ELAPSED</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>ruser</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>RUSER</b></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>group</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>GROUP</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>time</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>TIME</b></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>nice</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>NI</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>tty</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>TT</b></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>pcpu</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>%CPU</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>user</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>USER</b></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>pgid</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>PGID</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>vsz</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>VSZ</b></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>pid</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>PID</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b> </b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b> </b></p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_104_11"></a>STDERR</h4>
|
|
|
|
<blockquote>
|
|
<p>The standard error shall be used only for diagnostic messages.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_104_12"></a>OUTPUT FILES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_104_13"></a>EXTENDED DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_104_14"></a>EXIT STATUS</h4>
|
|
|
|
<blockquote>
|
|
<p>The following exit values shall be returned:</p>
|
|
|
|
<dl compact>
|
|
<dt> 0</dt>
|
|
|
|
<dd>Successful completion.</dd>
|
|
|
|
<dt>>0</dt>
|
|
|
|
<dd>An error occurred.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_104_15"></a>CONSEQUENCES OF ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>Default.</p>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_04_104_16"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>Things can change while <i>ps</i> is running; the snapshot it gives is only true for an instant, and might not be accurate by
|
|
the time it is displayed.</p>
|
|
|
|
<p>The <b>args</b> format specifier is allowed to produce a truncated version of the command arguments. In some implementations,
|
|
this information is no longer available when the <i>ps</i> utility is executed.</p>
|
|
|
|
<p>If the field width is too narrow to display a textual ID, the system may use a numeric version. Normally, the system would be
|
|
expected to choose large enough field widths, but if a large number of fields were selected to write, it might squeeze fields to
|
|
their minimum sizes to fit on one line. One way to ensure adequate width for the textual IDs is to override the default header for
|
|
a field to make it larger than most or all user or group names.</p>
|
|
|
|
<p>There is no special quoting mechanism for header text. The header text is the rest of the argument. If multiple header changes
|
|
are needed, multiple <b>-o</b> options can be used, such as:</p>
|
|
|
|
<pre>
|
|
<tt>ps -o "user=User Name" -o pid=Process\ ID
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>On some implementations, especially multi-level secure systems, <i>ps</i> may be severely restricted and produce information
|
|
only about child processes owned by the user.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_104_17"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<p>The command:</p>
|
|
|
|
<pre>
|
|
<tt>ps -o user,pid,ppid=MOM -o args
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>writes at least the following in the POSIX locale:</p>
|
|
|
|
<pre>
|
|
<tt> USER PID MOM COMMAND
|
|
helene 34 12 ps -o uid,pid,ppid=MOM -o args
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>The contents of the <b>COMMAND</b> field need not be the same in all implementations, due to possible truncation.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_104_18"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>There is very little commonality between BSD and System V implementations of <i>ps</i>. Many options conflict or have subtly
|
|
different usages. The standard developers attempted to select a set of options for the base standard that were useful on a wide
|
|
range of systems and selected options that either can be implemented on both BSD and System V-based systems without breaking the
|
|
current implementations or where the options are sufficiently similar that any changes would not be unduly problematic for users or
|
|
implementors.</p>
|
|
|
|
<p>It is recognized that on some implementations, especially multi-level secure systems, <i>ps</i> may be nearly useless. The
|
|
default output has therefore been chosen such that it does not break historical implementations and also is likely to provide at
|
|
least some useful information on most systems.</p>
|
|
|
|
<p>The major change is the addition of the format specification capability. The motivation for this invention is to provide a
|
|
mechanism for users to access a wider range of system information, if the system permits it, in a portable manner. The fields
|
|
chosen to appear in this volume of IEEE Std 1003.1-2001 were arrived at after considering what concepts were likely to be
|
|
both reasonably useful to the "average" user and had a reasonable chance of being implemented on a wide range of systems. Again
|
|
it is recognized that not all systems are able to provide all the information and, conversely, some may wish to provide more. It is
|
|
hoped that the approach adopted will be sufficiently flexible and extensible to accommodate most systems. Implementations may be
|
|
expected to introduce new format specifiers.</p>
|
|
|
|
<p>The default output should consist of a short listing containing the process ID, terminal name, cumulative execution time, and
|
|
command name of each process.</p>
|
|
|
|
<p>The preference of the standard developers would have been to make the format specification an operand of the <i>ps</i> command.
|
|
Unfortunately, BSD usage precluded this.</p>
|
|
|
|
<p>At one time a format was included to display the environment array of the process. This was deleted because there is no portable
|
|
way to display it.</p>
|
|
|
|
<p>The <b>-A</b> option is equivalent to the BSD <b>-g</b> and the SVID <b>-e</b>. Because the two systems differed, a mnemonic
|
|
compromise was selected.</p>
|
|
|
|
<p>The <b>-a</b> option is described with some optional behavior because the SVID omits session leaders, but BSD does not.</p>
|
|
|
|
<p>In an early proposal, format specifiers appeared for priority and start time. The former was not defined adequately in this
|
|
volume of IEEE Std 1003.1-2001 and was removed in deference to the defined nice value; the latter because elapsed time
|
|
was considered to be more useful.</p>
|
|
|
|
<p>In a new BSD version of <i>ps</i>, a <b>-O</b> option can be used to write all of the default information, followed by
|
|
additional format specifiers. This was not adopted because the default output is implementation-defined. Nevertheless, this is a
|
|
useful option that should be reserved for that purpose. In the <b>-o</b> option for the POSIX Shell and Utilities <i>ps</i>, the
|
|
format is the concatenation of each <b>-o</b>. Therefore, the user can have an alias or function that defines the beginning of
|
|
their desired format and add more fields to the end of the output in certain cases where that would be useful.</p>
|
|
|
|
<p>The format of the terminal name is unspecified, but the descriptions of <i>ps</i>, <a href=
|
|
"../utilities/talk.html"><i>talk</i></a>, <a href="../utilities/who.html"><i>who</i></a>, and <a href=
|
|
"../utilities/write.html"><i>write</i></a> require that they all use the same format.</p>
|
|
|
|
<p>The <b>pcpu</b> field indicates that the CPU time available is determined in an unspecified manner. This is because it is
|
|
difficult to express an algorithm that is useful across all possible machine architectures. Historical counterparts to this value
|
|
have attempted to show percentage of use in the recent past, such as the preceding minute. Frequently, these values for all
|
|
processes did not add up to 100%. Implementations are encouraged to provide data in this field to users that will help them
|
|
identify processes currently affecting the performance of the system.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_104_19"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_104_20"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="kill.html"><i>kill</i>()</a> , <a href="nice.html"><i>nice</i>()</a> , <a href="renice.html"><i>renice</i></a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_104_21"></a>CHANGE HISTORY</h4>
|
|
|
|
<blockquote>
|
|
<p>First released in Issue 2.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_104_22"></a>Issue 6</h4>
|
|
|
|
<blockquote>
|
|
<p>This utility is marked as part of the User Portability Utilities option.</p>
|
|
|
|
<p>The normative text is reworded to avoid use of the term "must" for application requirements.</p>
|
|
|
|
<p>The <i>TZ</i> entry is added to the ENVIRONMENT VARIABLES section.</p>
|
|
</blockquote>
|
|
|
|
<div class="box"><em>End of informative text.</em></div>
|
|
|
|
<hr>
|
|
<hr size="2" noshade>
|
|
<center><font size="2"><!--footer start-->
|
|
UNIX ® is a registered Trademark of The Open Group.<br>
|
|
POSIX ® is a registered Trademark of The IEEE.<br>
|
|
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
|
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
|
]</font></center>
|
|
|
|
<!--footer end-->
|
|
<hr size="2" noshade>
|
|
</body>
|
|
</html>
|
|
|