isposix

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

git clone git://bebou.netlib.re/isposix

Log | Files | Refs | README |

fuser.html (14615B)


      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>fuser</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/fold.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/gencat.html" accesskey="N">Next
     19 &gt;&gt;&gt;</a></td>
     20 </tr>
     21 </table>
     22 <hr align="left" width="100%"></div>
     23 <script language="JavaScript" src="../jscript/codes.js"></script><basefont size="3">
     24 <center><font size="2">The Open Group Base Specifications Issue 8<br>
     25 IEEE Std 1003.1-2024<br>
     26 Copyright © 2001-2024 The IEEE and The Open Group</font></center>
     27 <hr size="2" noshade>
     28 <a name="top" id="top"></a> <a name="fuser" id="fuser"></a> <a name="tag_20_49" id="tag_20_49"></a><!-- fuser -->
     29 <h4 class="mansect"><a name="tag_20_49_01" id="tag_20_49_01"></a>NAME</h4>
     30 <blockquote>fuser — list process IDs of all processes that are using one or more named files</blockquote>
     31 <h4 class="mansect"><a name="tag_20_49_02" id="tag_20_49_02"></a>SYNOPSIS</h4>
     32 <blockquote class="synopsis">
     33 <div class="box"><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt=
     34 "[Option Start]" border="0"> fuser</tt> <b>[</b><tt>-cfu</tt><b>]</b> <i>file</i><tt>... <img src="../images/opt-end.gif" alt=
     35 "[Option End]" border="0"></tt></code></div>
     36 </blockquote>
     37 <h4 class="mansect"><a name="tag_20_49_03" id="tag_20_49_03"></a>DESCRIPTION</h4>
     38 <blockquote>
     39 <p>For each <i>file</i> operand, in order, <i>fuser</i> shall write one line of output, some of it to standard output, and the rest
     40 to standard error, giving information about processes running on the local system that are using the file. A process shall be
     41 considered to be using a file if it has at least one open file descriptor associated with the file or if the file is a directory
     42 that is the current working directory or the root directory for the process, and may be considered to be using a file for other
     43 implementation-dependent reasons. If <i>file</i> names a block special device that contains a mounted file system, and the
     44 <b>-f</b> option is not specified, any processes using any file on that mounted file system and any processes that are using the
     45 device file itself shall be listed.</p>
     46 <p>Any output for processes running on remote systems that are using a named file is unspecified.</p>
     47 <p>A user may need appropriate privileges to invoke the <i>fuser</i> utility.</p>
     48 <p>When standard output and standard error are directed to the same file, the output for each <i>file</i> operand shall be
     49 interleaved so that it is written to the file in the following order:</p>
     50 <ul>
     51 <li>
     52 <p>On standard error, a pathname for the file, immediately followed by a &lt;colon&gt; and zero or more &lt;blank&gt; characters.
     53 The pathname shall be either the file operand (unaltered) or the pathname that would result from a successful call to the <a href=
     54 "../functions/realpath.html"><i>realpath</i>()</a> function, defined in the System Interfaces volume of POSIX.1-2024, with the
     55 <i>file</i> operand as its <i>file_name</i> argument.</p>
     56 </li>
     57 <li>
     58 <p>For each process using the file:</p>
     59 <ul>
     60 <li>
     61 <p>On standard output, the process ID in the format:</p>
     62 <pre>
     63 <tt>" %1d", &lt;</tt><i>process ID</i><tt>&gt;
     64 </tt></pre></li>
     65 <li>
     66 <p>On standard error, information about the file's use by the process, in the following format:</p>
     67 <pre>
     68 <tt>"%s", &lt;</tt><i>use chars</i><tt>&gt;
     69 </tt></pre>
     70 <p>if the <b>-u</b> option is not specified, or in the following format:</p>
     71 <pre>
     72 <tt>"%s(%s)", &lt;</tt><i>use chars</i><tt>&gt;, &lt;</tt><i>user name</i><tt>&gt;
     73 </tt></pre>
     74 <p>if the <b>-u</b> option is specified, where &lt;<i>use chars</i>&gt; is a string of zero or more characters indicating the use
     75 of the file and &lt;<i>user name</i>&gt; is the user name corresponding to the real user ID of the process or, if the user name
     76 cannot be resolved from the real user ID of the process, the real user ID of the process in decimal. The value of &lt;<i>use
     77 chars</i>&gt; shall include the character <tt>'c'</tt> if the process is using the file as its current directory and the character
     78 <tt>'r'</tt> if the process is using the file as its root directory; implementations may include other alphabetic characters to
     79 indicate other uses of the file.</p>
     80 </li>
     81 </ul>
     82 </li>
     83 <li>
     84 <p>On standard error, a &lt;newline&gt; character.</p>
     85 </li>
     86 </ul>
     87 <p>When standard output and standard error are not directed to the same file, the data written to each shall be as described above
     88 but the ordering of writes to standard output relative to writes to standard error is unspecified. For example, <i>fuser</i> might
     89 first write the information for all file operands to standard error and then write all of the process IDs to standard output.</p>
     90 </blockquote>
     91 <h4 class="mansect"><a name="tag_20_49_04" id="tag_20_49_04"></a>OPTIONS</h4>
     92 <blockquote>
     93 <p>The <i>fuser</i> utility shall conform to XBD <a href="../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax
     94 Guidelines</i></a> .</p>
     95 <p>The following options shall be supported:</p>
     96 <dl compact>
     97 <dd></dd>
     98 <dt><b>-c</b></dt>
     99 <dd>If a <i>file</i> operand names a directory that is the mount point of a mounted file system, all processes using any file on
    100 that file system shall be listed as if they were using the named directory. The behavior for any <i>file</i> operand that names an
    101 existing file that is not the mount point of a mounted file system is unspecified.</dd>
    102 <dt><b>-f</b></dt>
    103 <dd>The report shall be only for the named files.</dd>
    104 <dt><b>-u</b></dt>
    105 <dd>The user name, in parentheses, associated with each process ID written to standard output shall be written to standard
    106 error.</dd>
    107 </dl>
    108 </blockquote>
    109 <h4 class="mansect"><a name="tag_20_49_05" id="tag_20_49_05"></a>OPERANDS</h4>
    110 <blockquote>
    111 <p>The following operand shall be supported:</p>
    112 <dl compact>
    113 <dd></dd>
    114 <dt><i>file</i></dt>
    115 <dd>A pathname of a file for which the processes using the file are to be reported.</dd>
    116 </dl>
    117 </blockquote>
    118 <h4 class="mansect"><a name="tag_20_49_06" id="tag_20_49_06"></a>STDIN</h4>
    119 <blockquote>
    120 <p>Not used.</p>
    121 </blockquote>
    122 <h4 class="mansect"><a name="tag_20_49_07" id="tag_20_49_07"></a>INPUT FILES</h4>
    123 <blockquote>
    124 <p>The user database.</p>
    125 </blockquote>
    126 <h4 class="mansect"><a name="tag_20_49_08" id="tag_20_49_08"></a>ENVIRONMENT VARIABLES</h4>
    127 <blockquote>
    128 <p>The following environment variables shall affect the execution of <i>fuser</i>:</p>
    129 <dl compact>
    130 <dd></dd>
    131 <dt><i>LANG</i></dt>
    132 <dd>Provide a default value for the internationalization variables that are unset or null. (See XBD <a href=
    133 "../basedefs/V1_chap08.html#tag_08_02"><i>8.2 Internationalization Variables</i></a> for the precedence of internationalization
    134 variables used to determine the values of locale categories.)</dd>
    135 <dt><i>LC_ALL</i></dt>
    136 <dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd>
    137 <dt><i>LC_CTYPE</i></dt>
    138 <dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as
    139 opposed to multi-byte characters in arguments).</dd>
    140 <dt><i>LC_MESSAGES</i></dt>
    141 <dd><br>
    142 Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.</dd>
    143 <dt><i>NLSPATH</i></dt>
    144 <dd>Determine the location of messages objects and message catalogs.</dd>
    145 </dl>
    146 </blockquote>
    147 <h4 class="mansect"><a name="tag_20_49_09" id="tag_20_49_09"></a>ASYNCHRONOUS EVENTS</h4>
    148 <blockquote>
    149 <p>Default.</p>
    150 </blockquote>
    151 <h4 class="mansect"><a name="tag_20_49_10" id="tag_20_49_10"></a>STDOUT</h4>
    152 <blockquote>
    153 <p>See DESCRIPTION.</p>
    154 </blockquote>
    155 <h4 class="mansect"><a name="tag_20_49_11" id="tag_20_49_11"></a>STDERR</h4>
    156 <blockquote>
    157 <p>The <i>fuser</i> utility shall write diagnostic messages to standard error.</p>
    158 <p>The <i>fuser</i> utility also shall write information to standard error as specified in the DESCRIPTION section.</p>
    159 </blockquote>
    160 <h4 class="mansect"><a name="tag_20_49_12" id="tag_20_49_12"></a>OUTPUT FILES</h4>
    161 <blockquote>
    162 <p>None.</p>
    163 </blockquote>
    164 <h4 class="mansect"><a name="tag_20_49_13" id="tag_20_49_13"></a>EXTENDED DESCRIPTION</h4>
    165 <blockquote>
    166 <p>None.</p>
    167 </blockquote>
    168 <h4 class="mansect"><a name="tag_20_49_14" id="tag_20_49_14"></a>EXIT STATUS</h4>
    169 <blockquote>
    170 <p>The following exit values shall be returned:</p>
    171 <dl compact>
    172 <dd></dd>
    173 <dt>&nbsp;0</dt>
    174 <dd>Successful completion.</dd>
    175 <dt>&gt;0</dt>
    176 <dd>An error occurred.</dd>
    177 </dl>
    178 </blockquote>
    179 <h4 class="mansect"><a name="tag_20_49_15" id="tag_20_49_15"></a>CONSEQUENCES OF ERRORS</h4>
    180 <blockquote>
    181 <p>Default.</p>
    182 </blockquote>
    183 <hr>
    184 <div class="box"><em>The following sections are informative.</em></div>
    185 <h4 class="mansect"><a name="tag_20_49_16" id="tag_20_49_16"></a>APPLICATION USAGE</h4>
    186 <blockquote>
    187 <p>Things can change while <i>fuser</i> is running; the snapshot it gives is only true for an instant, and might not be accurate by
    188 the time it is displayed.</p>
    189 </blockquote>
    190 <h4 class="mansect"><a name="tag_20_49_17" id="tag_20_49_17"></a>EXAMPLES</h4>
    191 <blockquote>
    192 <p>The command:</p>
    193 <pre>
    194 <tt>fuser -fu .
    195 </tt></pre>
    196 <p>writes to standard output the process IDs of processes that are using the current directory and writes to standard error an
    197 indication of how those processes are using the directory and the user names associated with the processes that are using the
    198 current directory.</p>
    199 <pre>
    200 <tt>fuser -c &lt;</tt><i>mount point</i><tt>&gt;
    201 </tt></pre>
    202 <p>writes to standard output the process IDs of processes that are using any file in the file system which is mounted on
    203 &lt;<i>mount point</i>&gt; and writes to standard error an indication of how those processes are using the files.</p>
    204 <pre>
    205 <tt>fuser &lt;</tt><i>mount point</i><tt>&gt;
    206 </tt></pre>
    207 <p>writes to standard output the process IDs of processes that are using the file which is named by &lt;<i>mount point</i>&gt; and
    208 writes to standard error an indication of how those processes are using the file.</p>
    209 <pre>
    210 <tt>fuser &lt;</tt><i>mounted block device</i><tt>&gt;
    211 </tt></pre>
    212 <p>writes to standard output the process IDs of processes that are using any file on the mounted file system contained by
    213 &lt;<i>mounted block device</i>&gt; and of processes that are using the device file &lt;<i>mounted block device</i>&gt; itself, and
    214 writes to standard error an indication of how those processes are using the files.</p>
    215 <pre>
    216 <tt>fuser -f &lt;</tt><i>mounted block device</i><tt>&gt;
    217 </tt></pre>
    218 <p>writes to standard output the process IDs of processes that are using the file &lt;<i>mounted block device</i>&gt; itself and
    219 writes to standard error an indication of how those processes are using the file.</p>
    220 </blockquote>
    221 <h4 class="mansect"><a name="tag_20_49_18" id="tag_20_49_18"></a>RATIONALE</h4>
    222 <blockquote>
    223 <p>The definition of the <i>fuser</i> utility follows existing practice.</p>
    224 </blockquote>
    225 <h4 class="mansect"><a name="tag_20_49_19" id="tag_20_49_19"></a>FUTURE DIRECTIONS</h4>
    226 <blockquote>
    227 <p>If this utility is directed to display a pathname that contains any bytes that have the encoded value of a &lt;newline&gt;
    228 character when &lt;newline&gt; is a terminator or separator in the output format being used, implementations are encouraged to
    229 treat this as an error. A future version of this standard may require implementations to treat this as an error.</p>
    230 </blockquote>
    231 <h4 class="mansect"><a name="tag_20_49_20" id="tag_20_49_20"></a>SEE ALSO</h4>
    232 <blockquote>
    233 <p>XBD <a href="../basedefs/V1_chap08.html#tag_08"><i>8. Environment Variables</i></a> , <a href=
    234 "../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax Guidelines</i></a></p>
    235 </blockquote>
    236 <h4 class="mansect"><a name="tag_20_49_21" id="tag_20_49_21"></a>CHANGE HISTORY</h4>
    237 <blockquote>
    238 <p>First released in Issue 5.</p>
    239 </blockquote>
    240 <h4 class="mansect"><a name="tag_20_49_22" id="tag_20_49_22"></a>Issue 7</h4>
    241 <blockquote>
    242 <p>SD5-XCU-ERN-90 is applied, updating the EXAMPLES section.</p>
    243 <p>SD5-XCU-ERN-97 is applied, updating the SYNOPSIS.</p>
    244 </blockquote>
    245 <h4 class="mansect"><a name="tag_20_49_23" id="tag_20_49_23"></a>Issue 8</h4>
    246 <blockquote>
    247 <p>Austin Group Defect 251 is applied, encouraging implementations to report an error if a utility is directed to display a
    248 pathname that contains any bytes that have the encoded value of a &lt;newline&gt; character when &lt;newline&gt; is a terminator or
    249 separator in the output format being used.</p>
    250 <p>Austin Group Defect 1122 is applied, changing the description of <i>NLSPATH .</i></p>
    251 <p>Austin Group Defect 1746 is applied, clarifying the output written to standard output and standard error.</p>
    252 </blockquote>
    253 <div class="box"><em>End of informative text.</em></div>
    254 <hr>
    255 <p>&nbsp;</p>
    256 <a href="#top"><span class="topOfPage">return to top of page</span></a><br>
    257 <hr size="2" noshade>
    258 <center><font size="2">UNIX® is a registered Trademark of The Open Group.<br>
    259 POSIX™ is a Trademark of The IEEE.<br>
    260 Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved<br>
    261 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
    262 "../functions/contents.html">XSH</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../xrat/contents.html">XRAT</a>
    263 ]</font></center>
    264 <hr size="2" noshade>
    265 <div class="NAVHEADER">
    266 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
    267 <tr class="nav">
    268 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/fold.html" accesskey="P">&lt;&lt;&lt;
    269 Previous</a></td>
    270 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
    271 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/gencat.html" accesskey="N">Next
    272 &gt;&gt;&gt;</a></td>
    273 </tr>
    274 </table>
    275 <hr align="left" width="100%"></div>
    276 </body>
    277 </html>