📄 ps.html
字号:
A process that has exited and has a parent, but has notyet been waited for by the parent, is marked<b>defunct</b>.<p>Under the option<b>-f</b>,<i>ps</i>tries to determine the command nameand arguments given when the process was createdby examining memory or the swap area.Failing this, the command name, as itwould appear without the option<b>-f</b>,is written in square brackets.<p>The<b>-o</b>option allows the output format to bespecified under user control.<p>The format specification must be a list of namespresented as a single argument,blank-or comma-separated.Each variable has a default header.The default header can be overriddenby appending an equals sign and the newtext of the header.The rest of the characters in the argumentwill be used as the header text.The fields specified will be written in the order specifiedon the command line, and should be arranged in columns in the output.The field widths will be selected by the system to be at leastas wide as the header text (default or overridden value).If the header text is null, such as<b>-o</b>user=,the field width will be at least as wide as thedefault header text.If all header text fields are null,no header line will be written.<p>The following names are recognised in the POSIX locale:<dl compact><dt><b>ruser</b><dd>The real user ID of the process.This will be the textual user ID,if it can be obtained and the field width permits,or a decimal representation otherwise.<dt><b>user</b><dd>The effective user ID of the process.This will be the textual user ID,if it can be obtained and the field width permits,or a decimal representation otherwise.<dt><b>rgroup</b><dd>The real group ID of the process.This will be the textual group ID,if it can be obtained and the field width permits,or a decimal representation otherwise.<dt><b>group</b><dd>The effective group ID of the process.This will be the textual group ID,if it can be obtained and the field width permits,or a decimal representation otherwise.<dt><b>pid</b><dd>The decimal value of the process ID.<dt><b>ppid</b><dd>The decimal value of the parent process ID.<dt><b>pgid</b><dd>The decimal value of the process group ID.<dt><b>pcpu</b><dd>The ratio of CPU time used recentlyto 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.<dt><b>vsz</b><dd>The size of the process in (virtual) memory in kilobytes as a decimal integer.<dt><b>nice</b><dd>The decimal value of the system scheduling priority of the process.See<i><a href="nice.html">nice</a></i>.<dt><b>etime</b><dd>In the POSIX locale, the elapsed time since the processwas started, in the form:<pre><code><b>[[</b><i>dd</i>-<b>]</b><i>hh</i>:<b>]</b><i>mm</i>:<i>ss</i></code></pre>where<i>dd</i>will 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 will be a decimal integer.The<i>hh</i>,<i>mm</i>and<i>ss</i>fields will be two-digit decimal integers padded on the left with zeros.<dt><b>time</b><dd>In the POSIX locale, the cumulative CPU time of the process in the form:<pre><code><b>[</b><i>dd</i>-<b>]</b><i>hh</i>:<i>mm</i>:<i>ss</i></code></pre>The<i>dd</i>,<i>hh</i>,<i>mm</i>and<i>ss</i>fields will be as described in the<b>etime</b>specifier.<dt><b>tty</b><dd>The name of the controlling terminal of the process(if any) in the same format used by the<i><a href="who.html">who</a></i>utility.<dt><b>comm</b><dd>The name of the command being executed(<i>argv</i>[0]value) as a string.<dt><b>args</b><dd>The command with all its arguments as a string.The implementation may truncate this value to the field width;it is implementation-dependent whether any further truncation occurs.It is unspecified whether the string represented is aversion of the argument list as it waspassed to the command when it started, or is aversion of the arguments as they mayhave been modified by the application.Applications cannot depend on being able tomodify their argument list and havingthat modification be reflected in the output of<i>ps</i>.</dl><p>Any field need not be meaningful in all implementations.In such a case a hyphen(-)should be output in place of the field value.<p>Only<b>comm</b>and<b>args</b>are allowed to containblank characters;all others are not.Any implementation-dependent variables will be specified in thesystem documentationalong with the default headerand indicating if the field may containblank characters.<p>The following tablespecifies the default header to be used in the POSIX localecorresponding to each format specifier.<pre><table bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Format Specifier</b><th align=center><b>Default Header</b><th align=center><b>Format Specifier</b><th align=center><b>Default Header</b><tr valign=top><td align=left>args<td align=left>COMMAND<td align=left>ppid<td align=left>PPID<tr valign=top><td align=left>comm<td align=left>COMMAND<td align=left>rgroup<td align=left>RGROUP<tr valign=top><td align=left>etime<td align=left>ELAPSED<td align=left>ruser<td align=left>RUSER<tr valign=top><td align=left>group<td align=left>GROUP<td align=left>time<td align=left>TIME<tr valign=top><td align=left>nice<td align=left>NI<td align=left>tty<td align=left>TT<tr valign=top><td align=left>pcpu<td align=left>%CPU<td align=left>user<td align=left>USER<tr valign=top><td align=left>pgid<td align=left>PGID<td align=left>vsz<td align=left>VSZ<tr valign=top><td align=left>pid<td align=left>PID<td align=left> <td align=left> </table></pre><h6 align=center><xref table="Variable Names and Default Headers in <I>ps</i>"></xref>Table: Variable Names and Default Headers in <i>ps</i></h6></blockquote><h4><a name = "tag_001_014_1812"> </a>STDERR</h4><blockquote>Used only for diagnostic messages.</blockquote><h4><a name = "tag_001_014_1813"> </a>OUTPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_1814"> </a>EXTENDED DESCRIPTION</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_1815"> </a>EXIT STATUS</h4><blockquote>The following exit values are returned:<dl compact><dt>0<dd>Successful completion.<dt>>0<dd>An error occurred.</dl></blockquote><h4><a name = "tag_001_014_1816"> </a>CONSEQUENCES OF ERRORS</h4><blockquote>Default.</blockquote><h4><a name = "tag_001_014_1817"> </a>APPLICATION USAGE</h4><blockquote>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>The<b>args</b>format specifier is allowed to produce a truncatedversion of the command arguments.In some implementations, this informationis no longer available when the<i>ps</i>utility is executed.<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 largeenough field widths, but if a large number of fieldswere selected to write, it might squeeze fieldsto their minimum sizes to fit on one line.One way to ensure adequate width for the textual IDsis to override thedefault header for a field to make it larger thanmost or all user or group names.<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:<pre><code>ps -o "user=User Name" -o pid=Process\ ID</code></pre><p>On some systems, especially multi-level secure systems,<i>ps</i>may be severely restricted and produce informationonly about child processes owned by the user.<br></blockquote><h4><a name = "tag_001_014_1818"> </a>EXAMPLES</h4><blockquote>The command:<pre><code>ps -o user,pid,ppid=MOM -o args</code></pre>writes at least the following in the POSIX locale:<pre><dl compact><dt> <dd><table <tr valign=top><th align=right>USER<th align=left>PID<th align=right>MOM<th align=left>COMMAND<tr valign=top><td align=right>helene<td align=left>34<td align=right>12<td align=left>ps -o uid,pid,ppid=MOM -o args</table></dl></pre>The contents of the<b>COMMAND</b>field need not be the same in all implementations, dueto possible truncation.</blockquote><h4><a name = "tag_001_014_1819"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_1820"> </a>SEE ALSO</h4><blockquote><i><a href="kill.html">kill</a></i>,<i><a href="nice.html">nice</a></i>,<i><a href="renice.html">renice</a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -