📄 ps.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-2004 IEEE and 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, 2004 Edition<br>Copyright © 2001-2004 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 obtaininformation 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 controllingterminal 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 thatthe <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 formatof 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>-separatedconcatenation 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 inan 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 ensurethat the <i>userlist</i> is a single argument in the form of a <blank> or comma-separated list. In the listing, the numericaluser 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 shallensure 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, thedefault list shall be ignored and <i>ps</i> shall select the processes represented by the inclusive OR of all theselection-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 theBase Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap08.html">Chapter 8, EnvironmentVariables</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 ofIEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap08.html#tag_08_02">Section 8.2, Internationalization Variables</a> forthe 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 asopposed 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 andinformative 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 defaulttimezone 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 aprocess; 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 byexamining memory or the swap area. Failing this, the command name, as it would appear without the option <b>-f</b>, is written insquare 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> orcomma-separated. Each variable has a default header. The default header can be overridden by appending an equals sign and the newtext of the header. The rest of the characters in the argument shall be used as the header text. The fields specified shall bewritten in the order specified on the command line, and should be arranged in columns in the output. The field widths shall beselected 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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -