📄 ps.html
字号:
<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 adecimal 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, ora 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 adecimal 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> fieldsshall 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 isimplementation-defined whether any further truncation occurs. It is unspecified whether the string represented is a version of theargument list as it was passed to the command when it started, or is a version of the arguments as they may have been modified bythe application. Applications cannot depend on being able to modify their argument list and having that modification be reflectedin 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 ofthe 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-definedvariables 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 bythe 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 beexpected to choose large enough field widths, but if a large number of fields were selected to write, it might squeeze fields totheir minimum sizes to fit on one line. One way to ensure adequate width for the textual IDs is to override the default header fora 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 changesare 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 informationonly 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 COMMANDhelene 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 subtlydifferent usages. The standard developers attempted to select a set of options for the base standard that were useful on a widerange of systems and selected options that either can be implemented on both BSD and System V-based systems without breaking thecurrent implementations or where the options are sufficiently similar that any changes would not be unduly problematic for users orimplementors.</p><p>It is recognized that on some implementations, especially multi-level secure systems, <i>ps</i> may be nearly useless. Thedefault output has therefore been chosen such that it does not break historical implementations and also is likely to provide atleast 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 amechanism for users to access a wider range of system information, if the system permits it, in a portable manner. The fieldschosen to appear in this volume of IEEE Std 1003.1-2001 were arrived at after considering what concepts were likely to beboth reasonably useful to the "average" user and had a reasonable chance of being implemented on a wide range of systems. Againit is recognized that not all systems are able to provide all the information and, conversely, some may wish to provide more. It ishoped that the approach adopted will be sufficiently flexible and extensible to accommodate most systems. Implementations may beexpected 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, andcommand 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 portableway 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 mnemoniccompromise 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 thisvolume of IEEE Std 1003.1-2001 and was removed in deference to the defined nice value; the latter because elapsed timewas 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 byadditional format specifiers. This was not adopted because the default output is implementation-defined. Nevertheless, this is auseful option that should be reserved for that purpose. In the <b>-o</b> option for the POSIX Shell and Utilities <i>ps</i>, theformat is the concatenation of each <b>-o</b>. Therefore, the user can have an alias or function that defines the beginning oftheir 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 isdifficult to express an algorithm that is useful across all possible machine architectures. Historical counterparts to this valuehave attempted to show percentage of use in the recent past, such as the preceding minute. Frequently, these values for allprocesses did not add up to 100%. Implementations are encouraged to provide data in this field to users that will help themidentify 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 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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -