isposix

Un outil pour savoir si une commande est posix - retour accueil

git clone git://bebou.netlib.re/isposix
Log | Files | Refs | README |

ps.html (34638B)


      1 <!-- Copyright 2001-2024 IEEE and The Open Group, All Rights Reserved -->
      2 <!DOCTYPE HTML>
      3 <html lang="en">
      4 <head>
      5 <meta name="generator" content="HTML Tidy for HTML5 for Linux version 5.8.0">
      6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      7 <link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group rhtm tool v1.2.4 -->
      8 <!-- Copyright (c) 2001-2024 The Open Group, All Rights Reserved -->
      9 <title>ps</title>
     10 </head>
     11 <body bgcolor="white">
     12 <div class="NAVHEADER">
     13 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
     14 <tr class="nav">
     15 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/prs.html" accesskey="P">&lt;&lt;&lt;
     16 Previous</a></td>
     17 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
     18 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/pwd.html" accesskey="N">Next &gt;&gt;&gt;</a></td>
     19 </tr>
     20 </table>
     21 <hr align="left" width="100%"></div>
     22 <script language="JavaScript" src="../jscript/codes.js"></script><basefont size="3">
     23 <center><font size="2">The Open Group Base Specifications Issue 8<br>
     24 IEEE Std 1003.1-2024<br>
     25 Copyright © 2001-2024 The IEEE and The Open Group</font></center>
     26 <hr size="2" noshade>
     27 <a name="top" id="top"></a> <a name="ps" id="ps"></a> <a name="tag_20_98" id="tag_20_98"></a><!-- ps -->
     28 <h4 class="mansect"><a name="tag_20_98_01" id="tag_20_98_01"></a>NAME</h4>
     29 <blockquote>ps — report process status</blockquote>
     30 <h4 class="mansect"><a name="tag_20_98_02" id="tag_20_98_02"></a>SYNOPSIS</h4>
     31 <blockquote class="synopsis">
     32 <p><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> ps</tt> <b>[</b><tt>-aAw</tt><b>] [</b><tt>-defl</tt><b>]
     33 [</b><tt>-g</tt> <i>grouplist</i><b>]<img src="../images/opt-end.gif" alt="[Option End]" border="0"> [</b><tt>-G</tt>
     34 <i>grouplist</i><b>]<br></b> <tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt> <b>[</b><tt>-n</tt> <i>namelist</i><b>]<img src=
     35 "../images/opt-end.gif" alt="[Option End]" border="0"> [</b><tt>-o</tt> <i>format</i><b>]</b><tt>...</tt> <b>[</b><tt>-p</tt>
     36 <i>proclist</i><b>] [</b><tt>-t</tt> <i>termlist</i><b>]<br></b> <tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt> <b>[</b><tt>-u</tt>
     37 <i>userlist</i><b>]<img src="../images/opt-end.gif" alt="[Option End]" border="0"> [</b><tt>-U</tt> <i>userlist</i><b>]</b></code></p>
     38 </blockquote>
     39 <h4 class="mansect"><a name="tag_20_98_03" id="tag_20_98_03"></a>DESCRIPTION</h4>
     40 <blockquote>
     41 <p>The <i>ps</i> utility shall write information about processes, subject to having appropriate privileges to obtain information
     42 about those processes.</p>
     43 <p>By default, <i>ps</i> shall select all processes with the same effective user ID as the current user and the same controlling
     44 terminal as the invoker.</p>
     45 </blockquote>
     46 <h4 class="mansect"><a name="tag_20_98_04" id="tag_20_98_04"></a>OPTIONS</h4>
     47 <blockquote>
     48 <p>The <i>ps</i> utility shall conform to XBD <a href="../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax
     49 Guidelines</i></a> .</p>
     50 <p>The following options shall be supported:</p>
     51 <dl compact>
     52 <dd></dd>
     53 <dt><b>-a</b></dt>
     54 <dd>Write information for all processes associated with terminals. Implementations may omit session leaders from this list.</dd>
     55 <dt><b>-A</b></dt>
     56 <dd>Write information for all processes.</dd>
     57 <dt><b>-d</b></dt>
     58 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
     59 Write information for all processes, except session leaders. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
     60 <dt><b>-e</b></dt>
     61 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
     62 Write information for all processes. <img src="../images/opt-end.gif" alt="[Option End]" border="0"> (Equivalent to
     63 <b>-A</b>.)</dd>
     64 <dt><b>-f</b></dt>
     65 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
     66 Generate a <b>full</b> listing. (See the STDOUT section for the contents of a <b>full</b> listing.) <img src=
     67 "../images/opt-end.gif" alt="[Option End]" border="0"></dd>
     68 <dt><b>-g&nbsp;</b><i>grouplist</i></dt>
     69 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
     70 Write information for processes whose session leaders are given in <i>grouplist</i>. The application shall ensure that the
     71 <i>grouplist</i> is a single argument in the form of a &lt;blank&gt; or &lt;comma&gt;-separated list. <img src=
     72 "../images/opt-end.gif" alt="[Option End]" border="0"></dd>
     73 <dt><b>-G&nbsp;</b><i>grouplist</i></dt>
     74 <dd>Write information for processes whose real group ID numbers are given in <i>grouplist</i>. The application shall ensure that
     75 the <i>grouplist</i> is a single argument in the form of a &lt;blank&gt; or &lt;comma&gt;-separated list.</dd>
     76 <dt><b>-l</b></dt>
     77 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
     78 Generate a <b>long</b> listing. (See STDOUT for the contents of a <b>long</b> listing.) <img src="../images/opt-end.gif" alt=
     79 "[Option End]" border="0"></dd>
     80 <dt><b>-n&nbsp;</b><i>namelist</i></dt>
     81 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
     82 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
     83 of a <i>namelist</i> file are unspecified. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
     84 <dt><b>-o&nbsp;</b><i>format</i></dt>
     85 <dd>Write information according to the format specification given in <i>format</i>. This is fully described in the STDOUT section.
     86 Multiple <b>-o</b> options can be specified; the format specification shall be interpreted as the &lt;space&gt;-separated
     87 concatenation of all the <i>format</i> option-arguments.</dd>
     88 <dt><b>-p&nbsp;</b><i>proclist</i></dt>
     89 <dd>Write information for processes whose process ID numbers are given in <i>proclist</i>. The application shall ensure that the
     90 <i>proclist</i> is a single argument in the form of a &lt;blank&gt; or &lt;comma&gt;-separated list.</dd>
     91 <dt><b>-t&nbsp;</b><i>termlist</i></dt>
     92 <dd>Write information for processes associated with terminals given in <i>termlist</i>. The application shall ensure that the
     93 <i>termlist</i> is a single argument in the form of a &lt;blank&gt; or &lt;comma&gt;-separated list. Terminal identifiers shall be
     94 given in an implementation-defined format. <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src=
     95 "../images/opt-start.gif" alt="[Option Start]" border="0"> &nbsp;On XSI-conformant systems, they shall be given in one of two
     96 forms: the device's filename (for example, <b>tty04</b>) or, if the device's filename starts with <b>tty</b>, just the identifier
     97 following the characters <b>tty</b> (for example, <tt>"04"</tt>). <img src="../images/opt-end.gif" alt="[Option End]" border=
     98 "0"></dd>
     99 <dt><b>-u&nbsp;</b><i>userlist</i></dt>
    100 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
    101 Write information for processes whose user ID numbers or login names are given in <i>userlist</i>. The application shall ensure
    102 that the <i>userlist</i> is a single argument in the form of a &lt;blank&gt; or &lt;comma&gt;-separated list. In the listing, the
    103 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=
    104 "../images/opt-end.gif" alt="[Option End]" border="0"></dd>
    105 <dt><b>-U&nbsp;</b><i>userlist</i></dt>
    106 <dd>Write information for processes whose real user ID numbers or login names are given in <i>userlist</i>. The application shall
    107 ensure that the <i>userlist</i> is a single argument in the form of a &lt;blank&gt; or &lt;comma&gt;-separated list.</dd>
    108 <dt><b>-w</b></dt>
    109 <dd>Behave as if the <i>COLUMNS</i> environment variable had a value of at least 132. If the <b>-w</b> option is not specified or
    110 is specified exactly once, all output lines shall contain no more than the greater of {LINE_MAX} and <i>COLUMNS</i> bytes provided
    111 that no format name is specified multiple times.</dd>
    112 </dl>
    113 <p>With the exception of <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt=
    114 "[Option Start]" border="0"> <b>-f</b>, <b>-l</b>, <b>-n</b> <i>namelist</i>, <img src="../images/opt-end.gif" alt="[Option End]"
    115 border="0"> &nbsp;and <b>-o</b> <i>format</i>, all of the options shown are used to select processes. If any are specified, the
    116 default list shall be ignored and <i>ps</i> shall select the processes represented by the inclusive OR of all the
    117 selection-criteria options.</p>
    118 </blockquote>
    119 <h4 class="mansect"><a name="tag_20_98_05" id="tag_20_98_05"></a>OPERANDS</h4>
    120 <blockquote>
    121 <p>None.</p>
    122 </blockquote>
    123 <h4 class="mansect"><a name="tag_20_98_06" id="tag_20_98_06"></a>STDIN</h4>
    124 <blockquote>
    125 <p>Not used.</p>
    126 </blockquote>
    127 <h4 class="mansect"><a name="tag_20_98_07" id="tag_20_98_07"></a>INPUT FILES</h4>
    128 <blockquote>
    129 <p>None.</p>
    130 </blockquote>
    131 <h4 class="mansect"><a name="tag_20_98_08" id="tag_20_98_08"></a>ENVIRONMENT VARIABLES</h4>
    132 <blockquote>
    133 <p>The following environment variables shall affect the execution of <i>ps</i>:</p>
    134 <dl compact>
    135 <dd></dd>
    136 <dt><i>COLUMNS</i></dt>
    137 <dd>Override the system-selected horizontal display line size, used to determine the number of text columns to display. See XBD
    138 <a href="../basedefs/V1_chap08.html#tag_08"><i>8. Environment Variables</i></a> for valid values and results when it is unset or
    139 null.</dd>
    140 <dt><i>LANG</i></dt>
    141 <dd>Provide a default value for the internationalization variables that are unset or null. (See XBD <a href=
    142 "../basedefs/V1_chap08.html#tag_08_02"><i>8.2 Internationalization Variables</i></a> the precedence of internationalization
    143 variables used to determine the values of locale categories.)</dd>
    144 <dt><i>LC_ALL</i></dt>
    145 <dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd>
    146 <dt><i>LC_CTYPE</i></dt>
    147 <dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as
    148 opposed to multi-byte characters in arguments).</dd>
    149 <dt><i>LC_MESSAGES</i></dt>
    150 <dd><br>
    151 Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error and
    152 informative messages written to standard output.</dd>
    153 <dt><i>LC_TIME</i></dt>
    154 <dd>Determine the format and contents of the date and time strings displayed.</dd>
    155 <dt><i>NLSPATH</i></dt>
    156 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
    157 Determine the location of messages objects and message catalogs. <img src="../images/opt-end.gif" alt="[Option End]" border=
    158 "0"></dd>
    159 <dt><i>TZ</i></dt>
    160 <dd>Determine the timezone used to calculate date and time strings displayed. If <i>TZ</i> is unset or null, an unspecified default
    161 timezone shall be used.</dd>
    162 </dl>
    163 </blockquote>
    164 <h4 class="mansect"><a name="tag_20_98_09" id="tag_20_98_09"></a>ASYNCHRONOUS EVENTS</h4>
    165 <blockquote>
    166 <p>Default.</p>
    167 </blockquote>
    168 <h4 class="mansect"><a name="tag_20_98_10" id="tag_20_98_10"></a>STDOUT</h4>
    169 <blockquote>
    170 <p>When the <b>-o</b> option is not specified, the standard output format is unspecified.<br></p>
    171 <p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
    172 On XSI-conformant systems, the output format shall be as follows. The column headings and descriptions of the columns in a
    173 <i>ps</i> listing are given below. The precise meanings of these fields are implementation-defined. The letters <tt>'f'</tt> and
    174 <tt>'l'</tt> (below) indicate the option (<b>full</b> or <b>long</b>) that shall cause the corresponding heading to appear;
    175 <b>all</b> means that the heading always appears. Note that these two options determine only what information is provided for a
    176 process; they do not determine which processes are listed.</p>
    177 <table cellpadding="3">
    178 <tr valign="top">
    179 <td align="left">
    180 <p class="tent"><b>F</b></p>
    181 </td>
    182 <td align="left">
    183 <p class="tent">(l)</p>
    184 </td>
    185 <td align="left">
    186 <p class="tent">Flags (octal and additive) associated with the process.</p>
    187 </td>
    188 </tr>
    189 <tr valign="top">
    190 <td align="left">
    191 <p class="tent"><b>S</b></p>
    192 </td>
    193 <td align="left">
    194 <p class="tent">(l)</p>
    195 </td>
    196 <td align="left">
    197 <p class="tent">The state of the process.</p>
    198 </td>
    199 </tr>
    200 <tr valign="top">
    201 <td align="left">
    202 <p class="tent"><b>UID</b></p>
    203 </td>
    204 <td align="left">
    205 <p class="tent">(f,l)</p>
    206 </td>
    207 <td align="left">
    208 <p class="tent">The user ID number of the process owner; the login name is printed under the <b>-f</b> option.</p>
    209 </td>
    210 </tr>
    211 <tr valign="top">
    212 <td align="left">
    213 <p class="tent"><b>PID</b></p>
    214 </td>
    215 <td align="left">
    216 <p class="tent">(all)</p>
    217 </td>
    218 <td align="left">
    219 <p class="tent">The process ID of the process; it is possible to kill a process if this datum is known.</p>
    220 </td>
    221 </tr>
    222 <tr valign="top">
    223 <td align="left">
    224 <p class="tent"><b>PPID</b></p>
    225 </td>
    226 <td align="left">
    227 <p class="tent">(f,l)</p>
    228 </td>
    229 <td align="left">
    230 <p class="tent">The process ID of the parent process.</p>
    231 </td>
    232 </tr>
    233 <tr valign="top">
    234 <td align="left">
    235 <p class="tent"><b>C</b></p>
    236 </td>
    237 <td align="left">
    238 <p class="tent">(f,l)</p>
    239 </td>
    240 <td align="left">
    241 <p class="tent">Processor utilization for scheduling.</p>
    242 </td>
    243 </tr>
    244 <tr valign="top">
    245 <td align="left">
    246 <p class="tent"><b>PRI</b></p>
    247 </td>
    248 <td align="left">
    249 <p class="tent">(l)</p>
    250 </td>
    251 <td align="left">
    252 <p class="tent">The priority of the process; higher numbers mean lower priority.</p>
    253 </td>
    254 </tr>
    255 <tr valign="top">
    256 <td align="left">
    257 <p class="tent"><b>NI</b></p>
    258 </td>
    259 <td align="left">
    260 <p class="tent">(l)</p>
    261 </td>
    262 <td align="left">
    263 <p class="tent">Nice value; used in priority computation.</p>
    264 </td>
    265 </tr>
    266 <tr valign="top">
    267 <td align="left">
    268 <p class="tent"><b>ADDR</b></p>
    269 </td>
    270 <td align="left">
    271 <p class="tent">(l)</p>
    272 </td>
    273 <td align="left">
    274 <p class="tent">The address of the process.</p>
    275 </td>
    276 </tr>
    277 <tr valign="top">
    278 <td align="left">
    279 <p class="tent"><b>SZ</b></p>
    280 </td>
    281 <td align="left">
    282 <p class="tent">(l)</p>
    283 </td>
    284 <td align="left">
    285 <p class="tent">The size in pages of the total memory requirements of the process, including text, data, stack, mapped memory and
    286 other resources.</p>
    287 </td>
    288 </tr>
    289 <tr valign="top">
    290 <td align="left">
    291 <p class="tent"><b>WCHAN</b></p>
    292 </td>
    293 <td align="left">
    294 <p class="tent">(l)</p>
    295 </td>
    296 <td align="left">
    297 <p class="tent">The event for which the process is waiting or sleeping; if blank, the process is running.</p>
    298 </td>
    299 </tr>
    300 <tr valign="top">
    301 <td align="left">
    302 <p class="tent"><b>STIME</b></p>
    303 </td>
    304 <td align="left">
    305 <p class="tent">(f)</p>
    306 </td>
    307 <td align="left">
    308 <p class="tent">Starting time of the process.</p>
    309 </td>
    310 </tr>
    311 <tr valign="top">
    312 <td align="left">
    313 <p class="tent"><b>TTY</b></p>
    314 </td>
    315 <td align="left">
    316 <p class="tent">(all)</p>
    317 </td>
    318 <td align="left">
    319 <p class="tent">The controlling terminal for the process.</p>
    320 </td>
    321 </tr>
    322 <tr valign="top">
    323 <td align="left">
    324 <p class="tent"><b>TIME</b></p>
    325 </td>
    326 <td align="left">
    327 <p class="tent">(all)</p>
    328 </td>
    329 <td align="left">
    330 <p class="tent">The cumulative execution time for the process.</p>
    331 </td>
    332 </tr>
    333 <tr valign="top">
    334 <td align="left">
    335 <p class="tent"><b>CMD</b></p>
    336 </td>
    337 <td align="left">
    338 <p class="tent">(all)</p>
    339 </td>
    340 <td align="left">
    341 <p class="tent">The command name; the full command name and its arguments are written under the <b>-f</b> option.</p>
    342 </td>
    343 </tr>
    344 </table>
    345 <p class="tent">A process that has exited and has a parent, but has not yet been waited for by the parent, shall be marked
    346 <b>defunct</b>.</p>
    347 <p class="tent">Under the option <b>-f</b>, <i>ps</i> tries to determine the command name and arguments given when the process was
    348 created by examining memory or the swap area. Failing this, the command name, as it would appear without the option <b>-f</b>, is
    349 written in square brackets. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
    350 <p class="tent">The <b>-o</b> option allows the output format to be specified under user control.</p>
    351 <p class="tent">The application shall ensure that the format specification is a list of names presented as a single argument,
    352 &lt;blank&gt; or &lt;comma&gt;-separated. Each variable has a default header. The default header can be overridden by appending an
    353 &lt;equals-sign&gt; and the new text of the header. The rest of the characters in the argument shall be used as the header text.
    354 The fields specified shall be written in the order specified on the command line, and should be arranged in columns in the output.
    355 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
    356 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
    357 header text fields are null, no header line shall be written.</p>
    358 <p class="tent">The following names are recognized in the POSIX locale:</p>
    359 <dl compact>
    360 <dd></dd>
    361 <dt><b>ruser</b></dt>
    362 <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
    363 decimal representation otherwise.</dd>
    364 <dt><b>user</b></dt>
    365 <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
    366 a decimal representation otherwise.</dd>
    367 <dt><b>rgroup</b></dt>
    368 <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
    369 decimal representation otherwise.</dd>
    370 <dt><b>group</b></dt>
    371 <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,
    372 or a decimal representation otherwise.</dd>
    373 <dt><b>pid</b></dt>
    374 <dd>The decimal value of the process ID.</dd>
    375 <dt><b>ppid</b></dt>
    376 <dd>The decimal value of the parent process ID.</dd>
    377 <dt><b>pgid</b></dt>
    378 <dd>The decimal value of the process group ID.</dd>
    379 <dt><b>pcpu</b></dt>
    380 <dd>The ratio of CPU time used recently to CPU time available in the same period, expressed as a percentage. The meaning of
    381 &quot;recently&quot; in this context is unspecified. The CPU time available is determined in an unspecified manner.</dd>
    382 <dt><b>vsz</b></dt>
    383 <dd>The size of the process in (virtual) memory in 1024 byte units as a decimal integer.</dd>
    384 <dt><b>nice</b></dt>
    385 <dd>The decimal value of the nice value of the process; see <a href="../utilities/nice.html"><i>nice</i></a>.</dd>
    386 <dt><b>etime</b></dt>
    387 <dd>In the POSIX locale, the elapsed time since the process was started, in the form:
    388 <pre>
    389 <b>[[</b><i>dd</i><tt>-</tt><b>]</b><i>hh</i><tt>:</tt><b>]</b><i>mm</i><tt>:</tt><i>ss</i><tt>
    390 </tt></pre>
    391 <p class="tent">where <i>dd</i> shall represent the number of days, <i>hh</i> the number of hours, <i>mm</i> the number of minutes,
    392 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
    393 shall be two-digit decimal integers padded on the left with zeros.</p>
    394 </dd>
    395 <dt><b>time</b></dt>
    396 <dd>In the POSIX locale, the cumulative CPU time of the process in the form:
    397 <pre>
    398 <b>[</b><i>dd</i><tt>-</tt><b>]</b><i>hh</i><tt>:</tt><i>mm</i><tt>:</tt><i>ss</i><tt>
    399 </tt></pre>
    400 <p class="tent">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>
    401 </dd>
    402 <dt><b>tty</b></dt>
    403 <dd>The name of the controlling terminal of the process (if any) in the same format used by the <a href=
    404 "../utilities/who.html"><i>who</i></a> utility.</dd>
    405 <dt><b>comm</b></dt>
    406 <dd>The name of the command being executed (<i>argv</i>[0] value) as a string.</dd>
    407 <dt><b>args</b></dt>
    408 <dd>The command with all its arguments as a string. The implementation may truncate this value to the field width; it is
    409 implementation-defined whether any further truncation occurs. It is unspecified whether the string represented is a version of the
    410 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
    411 the application. Applications cannot depend on being able to modify their argument list and having that modification be reflected
    412 in the output of <i>ps</i>.</dd>
    413 </dl>
    414 <p class="tent">Any field need not be meaningful in all implementations. In such a case a &lt;hyphen-minus&gt; (<tt>'-'</tt>)
    415 should be output in place of the field value.</p>
    416 <p class="tent">Only <b>comm</b> and <b>args</b> shall be allowed to contain &lt;blank&gt; characters; all others shall not. Any
    417 implementation-defined variables shall be specified in the system documentation along with the default header and indicating
    418 whether the field may contain &lt;blank&gt; characters.</p>
    419 <p class="tent">The following table specifies the default header to be used in the POSIX locale corresponding to each format
    420 specifier.<br></p>
    421 <p class="caption">Table: Variable Names and Default Headers in <i>ps</i></p>
    422 <center>
    423 <table border="1" cellpadding="3" align="center">
    424 <tr valign="top">
    425 <th align="center">
    426 <p class="tent"><b>Format Specifier</b></p>
    427 </th>
    428 <th align="center">
    429 <p class="tent"><b>Default Header</b></p>
    430 </th>
    431 <th align="center">
    432 <p class="tent"><b>Format Specifier</b></p>
    433 </th>
    434 <th align="center">
    435 <p class="tent"><b>Default Header</b></p>
    436 </th>
    437 </tr>
    438 <tr valign="top">
    439 <td align="left">
    440 <p class="tent"><b>args</b></p>
    441 </td>
    442 <td align="left">
    443 <p class="tent"><b>COMMAND</b></p>
    444 </td>
    445 <td align="left">
    446 <p class="tent"><b>ppid</b></p>
    447 </td>
    448 <td align="left">
    449 <p class="tent"><b>PPID</b></p>
    450 </td>
    451 </tr>
    452 <tr valign="top">
    453 <td align="left">
    454 <p class="tent"><b>comm</b></p>
    455 </td>
    456 <td align="left">
    457 <p class="tent"><b>COMMAND</b></p>
    458 </td>
    459 <td align="left">
    460 <p class="tent"><b>rgroup</b></p>
    461 </td>
    462 <td align="left">
    463 <p class="tent"><b>RGROUP</b></p>
    464 </td>
    465 </tr>
    466 <tr valign="top">
    467 <td align="left">
    468 <p class="tent"><b>etime</b></p>
    469 </td>
    470 <td align="left">
    471 <p class="tent"><b>ELAPSED</b></p>
    472 </td>
    473 <td align="left">
    474 <p class="tent"><b>ruser</b></p>
    475 </td>
    476 <td align="left">
    477 <p class="tent"><b>RUSER</b></p>
    478 </td>
    479 </tr>
    480 <tr valign="top">
    481 <td align="left">
    482 <p class="tent"><b>group</b></p>
    483 </td>
    484 <td align="left">
    485 <p class="tent"><b>GROUP</b></p>
    486 </td>
    487 <td align="left">
    488 <p class="tent"><b>time</b></p>
    489 </td>
    490 <td align="left">
    491 <p class="tent"><b>TIME</b></p>
    492 </td>
    493 </tr>
    494 <tr valign="top">
    495 <td align="left">
    496 <p class="tent"><b>nice</b></p>
    497 </td>
    498 <td align="left">
    499 <p class="tent"><b>NI</b></p>
    500 </td>
    501 <td align="left">
    502 <p class="tent"><b>tty</b></p>
    503 </td>
    504 <td align="left">
    505 <p class="tent"><b>TT</b></p>
    506 </td>
    507 </tr>
    508 <tr valign="top">
    509 <td align="left">
    510 <p class="tent"><b>pcpu</b></p>
    511 </td>
    512 <td align="left">
    513 <p class="tent"><b>%CPU</b></p>
    514 </td>
    515 <td align="left">
    516 <p class="tent"><b>user</b></p>
    517 </td>
    518 <td align="left">
    519 <p class="tent"><b>USER</b></p>
    520 </td>
    521 </tr>
    522 <tr valign="top">
    523 <td align="left">
    524 <p class="tent"><b>pgid</b></p>
    525 </td>
    526 <td align="left">
    527 <p class="tent"><b>PGID</b></p>
    528 </td>
    529 <td align="left">
    530 <p class="tent"><b>vsz</b></p>
    531 </td>
    532 <td align="left">
    533 <p class="tent"><b>VSZ</b></p>
    534 </td>
    535 </tr>
    536 <tr valign="top">
    537 <td align="left">
    538 <p class="tent"><b>pid</b></p>
    539 </td>
    540 <td align="left">
    541 <p class="tent"><b>PID</b></p>
    542 </td>
    543 <td align="left">
    544 <p class="tent"><b>&nbsp;</b></p>
    545 </td>
    546 <td align="left">
    547 <p class="tent"><b>&nbsp;</b></p>
    548 </td>
    549 </tr>
    550 </table>
    551 </center>
    552 </blockquote>
    553 <h4 class="mansect"><a name="tag_20_98_11" id="tag_20_98_11"></a>STDERR</h4>
    554 <blockquote>
    555 <p>The standard error shall be used only for diagnostic messages.</p>
    556 </blockquote>
    557 <h4 class="mansect"><a name="tag_20_98_12" id="tag_20_98_12"></a>OUTPUT FILES</h4>
    558 <blockquote>
    559 <p>None.</p>
    560 </blockquote>
    561 <h4 class="mansect"><a name="tag_20_98_13" id="tag_20_98_13"></a>EXTENDED DESCRIPTION</h4>
    562 <blockquote>
    563 <p>None.</p>
    564 </blockquote>
    565 <h4 class="mansect"><a name="tag_20_98_14" id="tag_20_98_14"></a>EXIT STATUS</h4>
    566 <blockquote>
    567 <p>The following exit values shall be returned:</p>
    568 <dl compact>
    569 <dd></dd>
    570 <dt>&nbsp;0</dt>
    571 <dd>Successful completion.</dd>
    572 <dt>&gt;0</dt>
    573 <dd>An error occurred.</dd>
    574 </dl>
    575 </blockquote>
    576 <h4 class="mansect"><a name="tag_20_98_15" id="tag_20_98_15"></a>CONSEQUENCES OF ERRORS</h4>
    577 <blockquote>
    578 <p>Default.</p>
    579 </blockquote>
    580 <hr>
    581 <div class="box"><em>The following sections are informative.</em></div>
    582 <h4 class="mansect"><a name="tag_20_98_16" id="tag_20_98_16"></a>APPLICATION USAGE</h4>
    583 <blockquote>
    584 <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
    585 the time it is displayed.</p>
    586 <p class="tent">The <b>args</b> format specifier is allowed to produce a truncated version of the command arguments. In some
    587 implementations, this information is no longer available when the <i>ps</i> utility is executed.</p>
    588 <p class="tent">If the field width is too narrow to display a textual ID, the system may use a numeric version. Normally, the
    589 system would be expected to choose large enough field widths, but if a large number of fields were selected to write, it might
    590 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
    591 default header for a field to make it larger than most or all user or group names.</p>
    592 <p class="tent">Portable applications should not set <i>COLUMNS</i> to a value greater than {LINE_MAX} and should not specify the
    593 <b>-w</b> option more than once if the output will be used as input for a utility that requires a text file as input because lines
    594 containing more than {LINE_MAX} bytes may cause undefined behavior in some implementations of the utility.</p>
    595 <p class="tent">There is no special quoting mechanism for header text. The header text is the rest of the argument. If multiple
    596 header changes are needed, multiple <b>-o</b> options can be used, such as:</p>
    597 <pre>
    598 <tt>ps -o "user=User Name" -o pid=Process\ ID
    599 </tt></pre>
    600 <p class="tent">On some implementations, especially multi-level secure systems, <i>ps</i> may be severely restricted and produce
    601 information only about child processes owned by the user.</p>
    602 </blockquote>
    603 <h4 class="mansect"><a name="tag_20_98_17" id="tag_20_98_17"></a>EXAMPLES</h4>
    604 <blockquote>
    605 <p>The command:</p>
    606 <pre>
    607 <tt>ps -o user,pid,ppid=MOM -o args
    608 </tt></pre>
    609 <p class="tent">writes at least the following in the POSIX locale:</p>
    610 <pre>
    611 <tt>  USER   PID   MOM   COMMAND
    612 helene    34    12   ps -o user,pid,ppid=MOM -o args
    613 </tt></pre>
    614 <p class="tent">The contents of the <b>COMMAND</b> field need not be the same in all implementations, due to possible
    615 truncation.</p>
    616 </blockquote>
    617 <h4 class="mansect"><a name="tag_20_98_18" id="tag_20_98_18"></a>RATIONALE</h4>
    618 <blockquote>
    619 <p>There is very little commonality between BSD and System V implementations of <i>ps</i>. Many options conflict or have subtly
    620 different usages. The standard developers attempted to select a set of options for the base standard that were useful on a wide
    621 range of systems and selected options that either can be implemented on both BSD and System V-based systems without breaking the
    622 current implementations or where the options are sufficiently similar that any changes would not be unduly problematic for users or
    623 implementors.</p>
    624 <p class="tent">It is recognized that on some implementations, especially multi-level secure systems, <i>ps</i> may be nearly
    625 useless. The default output has therefore been chosen such that it does not break historical implementations and also is likely to
    626 provide at least some useful information on most systems.</p>
    627 <p class="tent">The major change is the addition of the format specification capability. The motivation for this invention is to
    628 provide a mechanism for users to access a wider range of system information, if the system permits it, in a portable manner. The
    629 fields chosen to appear in this volume of POSIX.1-2024 were arrived at after considering what concepts were likely to be both
    630 reasonably useful to the &quot;average&quot; user and had a reasonable chance of being implemented on a wide range of systems. Again it is
    631 recognized that not all systems are able to provide all the information and, conversely, some may wish to provide more. It is hoped
    632 that the approach adopted will be sufficiently flexible and extensible to accommodate most systems. Implementations may be expected
    633 to introduce new format specifiers.</p>
    634 <p class="tent">The default output should consist of a short listing containing the process ID, terminal name, cumulative execution
    635 time, and command name of each process.</p>
    636 <p class="tent">The preference of the standard developers would have been to make the format specification an operand of the
    637 <i>ps</i> command. Unfortunately, BSD usage precluded this.</p>
    638 <p class="tent">At one time a format was included to display the environment array of the process. This was deleted because there
    639 is no portable way to display it.</p>
    640 <p class="tent">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
    641 mnemonic compromise was selected.</p>
    642 <p class="tent">The <b>-a</b> option is described with some optional behavior because the SVID omits session leaders, but BSD does
    643 not.</p>
    644 <p class="tent">In an early proposal, format specifiers appeared for priority and start time. The former was not defined adequately
    645 in this volume of POSIX.1-2024 and was removed in deference to the defined nice value; the latter because elapsed time was
    646 considered to be more useful.</p>
    647 <p class="tent">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
    648 by additional format specifiers. This was not adopted because the default output is implementation-defined. Nevertheless, this is a
    649 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
    650 format is the concatenation of each <b>-o</b>. Therefore, the user can have an alias or function that defines the beginning of
    651 their desired format and add more fields to the end of the output in certain cases where that would be useful.</p>
    652 <p class="tent">The format of the terminal name is unspecified, but the descriptions of <i>ps</i>, <a href=
    653 "../utilities/talk.html"><i>talk</i></a>, <a href="../utilities/who.html"><i>who</i></a>, and <a href=
    654 "../utilities/write.html"><i>write</i></a> require that they all use the same format.</p>
    655 <p class="tent">The <b>pcpu</b> field indicates that the CPU time available is determined in an unspecified manner. This is because
    656 it is difficult to express an algorithm that is useful across all possible machine architectures. Historical counterparts to this
    657 value have attempted to show percentage of use in the recent past, such as the preceding minute. Frequently, these values for all
    658 processes did not add up to 100%. Implementations are encouraged to provide data in this field to users that will help them
    659 identify processes currently affecting the performance of the system.</p>
    660 </blockquote>
    661 <h4 class="mansect"><a name="tag_20_98_19" id="tag_20_98_19"></a>FUTURE DIRECTIONS</h4>
    662 <blockquote>
    663 <p>None.</p>
    664 </blockquote>
    665 <h4 class="mansect"><a name="tag_20_98_20" id="tag_20_98_20"></a>SEE ALSO</h4>
    666 <blockquote>
    667 <p><a href="../utilities/kill.html#tag_20_64"><i>kill</i></a> , <a href="../utilities/nice.html#tag_20_86"><i>nice</i></a> ,
    668 <a href="../utilities/renice.html#"><i>renice</i></a></p>
    669 <p class="tent">XBD <a href="../basedefs/V1_chap08.html#tag_08"><i>8. Environment Variables</i></a> , <a href=
    670 "../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax Guidelines</i></a></p>
    671 </blockquote>
    672 <h4 class="mansect"><a name="tag_20_98_21" id="tag_20_98_21"></a>CHANGE HISTORY</h4>
    673 <blockquote>
    674 <p>First released in Issue 2.</p>
    675 </blockquote>
    676 <h4 class="mansect"><a name="tag_20_98_22" id="tag_20_98_22"></a>Issue 6</h4>
    677 <blockquote>
    678 <p>This utility is marked as part of the User Portability Utilities option.</p>
    679 <p class="tent">The normative text is reworded to avoid use of the term &quot;must&quot; for application requirements.</p>
    680 <p class="tent">The <i>TZ</i> entry is added to the ENVIRONMENT VARIABLES section.</p>
    681 </blockquote>
    682 <h4 class="mansect"><a name="tag_20_98_23" id="tag_20_98_23"></a>Issue 7</h4>
    683 <blockquote>
    684 <p>SD5-XCU-ERN-97 is applied, updating the SYNOPSIS.</p>
    685 <p class="tent">SD5-XCU-ERN-148 is applied, updating the OPTIONS section.</p>
    686 <p class="tent">POSIX.1-2008, Technical Corrigendum 2, XCU/TC2-2008/0160 [584] is applied.</p>
    687 </blockquote>
    688 <h4 class="mansect"><a name="tag_20_98_24" id="tag_20_98_24"></a>Issue 8</h4>
    689 <blockquote>
    690 <p>Austin Group Defect 905 is applied, adding the <b>-w</b> option.</p>
    691 <p class="tent">Austin Group Defect 1122 is applied, changing the description of <i>NLSPATH .</i></p>
    692 <p class="tent">Austin Group Defect 1141 is applied, changing the description of <b>SZ</b> in the STDOUT section.</p>
    693 <p class="tent">Austin Group Defect 1175 is applied, changing &quot;uid&quot; to &quot;user&quot; in the EXAMPLES section.</p>
    694 </blockquote>
    695 <div class="box"><em>End of informative text.</em></div>
    696 <hr>
    697 <p>&nbsp;</p>
    698 <a href="#top"><span class="topOfPage">return to top of page</span></a><br>
    699 <hr size="2" noshade>
    700 <center><font size="2">UNIX® is a registered Trademark of The Open Group.<br>
    701 POSIX™ is a Trademark of The IEEE.<br>
    702 Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved<br>
    703 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
    704 "../functions/contents.html">XSH</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../xrat/contents.html">XRAT</a>
    705 ]</font></center>
    706 <hr size="2" noshade>
    707 <div class="NAVHEADER">
    708 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
    709 <tr class="nav">
    710 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/prs.html" accesskey="P">&lt;&lt;&lt;
    711 Previous</a></td>
    712 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
    713 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/pwd.html" accesskey="N">Next &gt;&gt;&gt;</a></td>
    714 </tr>
    715 </table>
    716 <hr align="left" width="100%"></div>
    717 </body>
    718 </html>