isposix

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

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

df.html (17189B)


      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>df</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/delta.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/diff.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="df" id="df"></a> <a name="tag_20_33" id="tag_20_33"></a><!-- df -->
     28 <h4 class="mansect"><a name="tag_20_33_01" id="tag_20_33_01"></a>NAME</h4>
     29 <blockquote>df — report free disk space</blockquote>
     30 <h4 class="mansect"><a name="tag_20_33_02" id="tag_20_33_02"></a>SYNOPSIS</h4>
     31 <blockquote class="synopsis">
     32 <p><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> df</tt> <b>[</b><tt>-k</tt><b>] [</b><tt>-P|<img src=
     33 "../images/opt-start.gif" border="0">-t</tt><b><img src="../images/opt-end.gif" border="0">]
     34 [</b><i>file</i><tt>...</tt><b>]</b></code></p>
     35 </blockquote>
     36 <h4 class="mansect"><a name="tag_20_33_03" id="tag_20_33_03"></a>DESCRIPTION</h4>
     37 <blockquote>
     38 <p>The <i>df</i> utility shall write the amount of available space <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup>
     39 <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> &nbsp;and file slots <img src="../images/opt-end.gif" alt=
     40 "[Option End]" border="0"> for file systems on which the invoking user has appropriate read access. File systems shall be specified
     41 by the <i>file</i> operands; when none are specified, information shall be written for all file systems. The format of the default
     42 output from <i>df</i> is unspecified, but all space figures are reported in 512-byte units, unless the <b>-k</b> option is
     43 specified. This output shall contain at least the file system names, amount of available space on each of these file systems,
     44 <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
     45 &nbsp;and, if no options other than <b>-t</b> are specified, the number of free file slots, or <i>inode</i>s, available; when
     46 <b>-t</b> is specified, the output shall contain the total allocated space as well. <img src="../images/opt-end.gif" alt=
     47 "[Option End]" border="0"></p>
     48 </blockquote>
     49 <h4 class="mansect"><a name="tag_20_33_04" id="tag_20_33_04"></a>OPTIONS</h4>
     50 <blockquote>
     51 <p>The <i>df</i> utility shall conform to XBD <a href="../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax
     52 Guidelines</i></a> .</p>
     53 <p>The following options shall be supported:</p>
     54 <dl compact>
     55 <dd></dd>
     56 <dt><b>-k</b></dt>
     57 <dd>Use 1024-byte units, instead of the default 512-byte units, when writing space figures.</dd>
     58 <dt><b>-P</b></dt>
     59 <dd>Produce output in the format described in the STDOUT section.</dd>
     60 <dt><b>-t</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 Include total allocated-space figures in the output. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
     63 </dl>
     64 </blockquote>
     65 <h4 class="mansect"><a name="tag_20_33_05" id="tag_20_33_05"></a>OPERANDS</h4>
     66 <blockquote>
     67 <p>The following operand shall be supported:</p>
     68 <dl compact>
     69 <dd></dd>
     70 <dt><i>file</i></dt>
     71 <dd>A pathname of a file within the hierarchy of the desired file system. If a file other than a FIFO, a regular file, a directory,
     72 <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
     73 &nbsp;or a special file representing the device containing the file system (for example, <b>/dev/dsk/0s1</b>) <img src=
     74 "../images/opt-end.gif" alt="[Option End]" border="0"> is specified, the results are unspecified. If the <i>file</i> operand names
     75 a file other than a special file containing a file system, <i>df</i> shall write the amount of free space in the file system
     76 containing the specified <i>file</i> operand. <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src=
     77 "../images/opt-start.gif" alt="[Option Start]" border="0"> &nbsp;Otherwise, <i>df</i> shall write the amount of free space in that
     78 file system. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
     79 </dl>
     80 </blockquote>
     81 <h4 class="mansect"><a name="tag_20_33_06" id="tag_20_33_06"></a>STDIN</h4>
     82 <blockquote>
     83 <p>Not used.</p>
     84 </blockquote>
     85 <h4 class="mansect"><a name="tag_20_33_07" id="tag_20_33_07"></a>INPUT FILES</h4>
     86 <blockquote>
     87 <p>None.</p>
     88 </blockquote>
     89 <h4 class="mansect"><a name="tag_20_33_08" id="tag_20_33_08"></a>ENVIRONMENT VARIABLES</h4>
     90 <blockquote>
     91 <p>The following environment variables shall affect the execution of <i>df</i>:</p>
     92 <dl compact>
     93 <dd></dd>
     94 <dt><i>LANG</i></dt>
     95 <dd>Provide a default value for the internationalization variables that are unset or null. (See XBD <a href=
     96 "../basedefs/V1_chap08.html#tag_08_02"><i>8.2 Internationalization Variables</i></a> for the precedence of internationalization
     97 variables used to determine the values of locale categories.)</dd>
     98 <dt><i>LC_ALL</i></dt>
     99 <dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd>
    100 <dt><i>LC_CTYPE</i></dt>
    101 <dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as
    102 opposed to multi-byte characters in arguments).</dd>
    103 <dt><i>LC_MESSAGES</i></dt>
    104 <dd><br>
    105 Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error and
    106 informative messages written to standard output.</dd>
    107 <dt><i>NLSPATH</i></dt>
    108 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
    109 Determine the location of messages objects and message catalogs. <img src="../images/opt-end.gif" alt="[Option End]" border=
    110 "0"></dd>
    111 </dl>
    112 </blockquote>
    113 <h4 class="mansect"><a name="tag_20_33_09" id="tag_20_33_09"></a>ASYNCHRONOUS EVENTS</h4>
    114 <blockquote>
    115 <p>Default.</p>
    116 </blockquote>
    117 <h4 class="mansect"><a name="tag_20_33_10" id="tag_20_33_10"></a>STDOUT</h4>
    118 <blockquote>
    119 <p>When both the <b>-k</b> and <b>-P</b> options are specified, the following header line shall be written (in the POSIX
    120 locale):</p>
    121 <pre>
    122 <tt>"Filesystem 1024-blocks Used Available Capacity Mounted on\n"
    123 </tt></pre>
    124 <p>When the <b>-P</b> option is specified without the <b>-k</b> option, the following header line shall be written (in the POSIX
    125 locale):</p>
    126 <pre>
    127 <tt>"Filesystem 512-blocks Used Available Capacity Mounted on\n"
    128 </tt></pre>
    129 <p>The implementation may adjust the spacing of the header line and the individual data lines so that the information is presented
    130 in orderly columns.</p>
    131 <p>The remaining output with <b>-P</b> shall consist of one line of information for each specified file system. These lines shall
    132 be formatted as follows:</p>
    133 <pre>
    134 <tt>"%s %d %d %d %d%% %s\n", &lt;</tt><i>file system name</i><tt>&gt;, &lt;</tt><i>total space</i><tt>&gt;,
    135     &lt;</tt><i>space used</i><tt>&gt;, &lt;</tt><i>space free</i><tt>&gt;, &lt;</tt><i>percentage used</i><tt>&gt;,
    136     &lt;</tt><i>file system root</i><tt>&gt;
    137 </tt></pre>
    138 <p>In the following list, all quantities expressed in 512-byte units (1024-byte when <b>-k</b> is specified) shall be rounded up to
    139 the next higher unit. The fields are:</p>
    140 <dl compact>
    141 <dd></dd>
    142 <dt>&lt;<i>file&nbsp;system&nbsp;name</i>&gt;</dt>
    143 <dd><br>
    144 The name of the file system, in an implementation-defined format.</dd>
    145 <dt>&lt;<i>total&nbsp;space</i>&gt;</dt>
    146 <dd>The total size of the file system in 512-byte units. The exact meaning of this figure is implementation-defined, but should
    147 include &lt;<i>space&nbsp;used</i>&gt;, &lt;<i>space&nbsp;free</i>&gt;, plus any space reserved by the system not normally
    148 available to a user.</dd>
    149 <dt>&lt;<i>space&nbsp;used</i>&gt;</dt>
    150 <dd>The total amount of space allocated to existing files in the file system, in 512-byte units.</dd>
    151 <dt>&lt;<i>space&nbsp;free</i>&gt;</dt>
    152 <dd>The total amount of space available within the file system for the creation of new files by unprivileged users, in 512-byte
    153 units. When this figure is less than or equal to zero, it shall not be possible to create any new files on the file system without
    154 first deleting others, unless the process has appropriate privileges. The figure written may be less than zero.</dd>
    155 <dt>&lt;<i>percentage&nbsp;used</i>&gt;</dt>
    156 <dd><br>
    157 The percentage of the normally available space that is currently allocated to all files on the file system. This shall be
    158 calculated using the fraction:
    159 <pre>
    160 <tt>&lt;</tt><i>space used</i><tt>&gt;/( &lt;</tt><i>space used</i><tt>&gt;+ &lt;</tt><i>space free</i><tt>&gt;)
    161 </tt></pre>
    162 <p>expressed as a percentage. This percentage may be greater than 100 if &lt;<i>space&nbsp;free</i>&gt; is less than zero. The
    163 percentage value shall be expressed as a positive integer, with any fractional result causing it to be rounded to the next highest
    164 integer.</p>
    165 </dd>
    166 <dt>&lt;<i>file&nbsp;system&nbsp;root</i>&gt;</dt>
    167 <dd><br>
    168 The directory below which the file system hierarchy appears.</dd>
    169 </dl>
    170 <p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
    171 The output format is unspecified when <b>-t</b> is used. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
    172 </blockquote>
    173 <h4 class="mansect"><a name="tag_20_33_11" id="tag_20_33_11"></a>STDERR</h4>
    174 <blockquote>
    175 <p>The standard error shall be used only for diagnostic messages.</p>
    176 </blockquote>
    177 <h4 class="mansect"><a name="tag_20_33_12" id="tag_20_33_12"></a>OUTPUT FILES</h4>
    178 <blockquote>
    179 <p>None.</p>
    180 </blockquote>
    181 <h4 class="mansect"><a name="tag_20_33_13" id="tag_20_33_13"></a>EXTENDED DESCRIPTION</h4>
    182 <blockquote>
    183 <p>None.</p>
    184 </blockquote>
    185 <h4 class="mansect"><a name="tag_20_33_14" id="tag_20_33_14"></a>EXIT STATUS</h4>
    186 <blockquote>
    187 <p>The following exit values shall be returned:</p>
    188 <dl compact>
    189 <dd></dd>
    190 <dt>&nbsp;0</dt>
    191 <dd>Successful completion.</dd>
    192 <dt>&gt;0</dt>
    193 <dd>An error occurred.</dd>
    194 </dl>
    195 </blockquote>
    196 <h4 class="mansect"><a name="tag_20_33_15" id="tag_20_33_15"></a>CONSEQUENCES OF ERRORS</h4>
    197 <blockquote>
    198 <p>Default.</p>
    199 </blockquote>
    200 <hr>
    201 <div class="box"><em>The following sections are informative.</em></div>
    202 <h4 class="mansect"><a name="tag_20_33_16" id="tag_20_33_16"></a>APPLICATION USAGE</h4>
    203 <blockquote>
    204 <p>On most systems, the &quot;name of the file system, in an implementation-defined format&quot; is the special file on which the file
    205 system is mounted.</p>
    206 <p>On large file systems, the calculation specified for percentage used can create huge rounding errors.</p>
    207 </blockquote>
    208 <h4 class="mansect"><a name="tag_20_33_17" id="tag_20_33_17"></a>EXAMPLES</h4>
    209 <blockquote>
    210 <ol>
    211 <li>
    212 <p>The following example writes portable information about the <b>/usr</b> file system:</p>
    213 <pre>
    214 <tt>df -P /usr
    215 </tt></pre></li>
    216 <li>
    217 <p>Assuming that <b>/usr/src</b> is part of the <b>/usr</b> file system, the following produces the same output as the previous
    218 example:</p>
    219 <pre>
    220 <tt>df -P /usr/src
    221 </tt></pre></li>
    222 </ol>
    223 </blockquote>
    224 <h4 class="mansect"><a name="tag_20_33_18" id="tag_20_33_18"></a>RATIONALE</h4>
    225 <blockquote>
    226 <p>The behavior of <i>df</i> with the <b>-P</b> option is the default action of the 4.2 BSD <i>df</i> utility. The uppercase
    227 <b>-P</b> was selected to avoid collision with a known industry extension using <b>-p</b>.</p>
    228 <p>Historical <i>df</i> implementations vary considerably in their default output. It was therefore necessary to describe the
    229 default output in a loose manner to accommodate all known historical implementations and to add a portable option (<b>-P</b>) to
    230 provide information in a portable format.</p>
    231 <p>The use of 512-byte units is historical practice and maintains compatibility with <a href="../utilities/ls.html"><i>ls</i></a>
    232 and other utilities in this volume of POSIX.1-2024. This does not mandate that the file system itself be based on 512-byte blocks.
    233 The <b>-k</b> option was added as a compromise measure. It was agreed by the standard developers that 512 bytes was the best
    234 default unit because of its complete historical consistency on System V (<i>versus</i> the mixed 512/1024-byte usage on BSD
    235 systems), and that a <b>-k</b> option to switch to 1024-byte units was a good compromise. Users who prefer the more logical
    236 1024-byte quantity can easily alias <i>df</i> to <i>df</i> <b>-k</b> without breaking many historical scripts relying on the
    237 512-byte units.</p>
    238 <p>It was suggested that <i>df</i> and the various related utilities be modified to access a <i>BLOCKSIZE</i> environment variable
    239 to achieve consistency and user acceptance. Since this is not historical practice on any system, it is left as a possible area for
    240 system extensions and will be re-evaluated in a future version if it is widely implemented.</p>
    241 </blockquote>
    242 <h4 class="mansect"><a name="tag_20_33_19" id="tag_20_33_19"></a>FUTURE DIRECTIONS</h4>
    243 <blockquote>
    244 <p>If this utility is directed to display a pathname that contains any bytes that have the encoded value of a &lt;newline&gt;
    245 character when &lt;newline&gt; is a terminator or separator in the output format being used, implementations are encouraged to
    246 treat this as an error. A future version of this standard may require implementations to treat this as an error.</p>
    247 </blockquote>
    248 <h4 class="mansect"><a name="tag_20_33_20" id="tag_20_33_20"></a>SEE ALSO</h4>
    249 <blockquote>
    250 <p><a href="../utilities/find.html#"><i>find</i></a></p>
    251 <p>XBD <a href="../basedefs/V1_chap08.html#tag_08"><i>8. Environment Variables</i></a> , <a href=
    252 "../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax Guidelines</i></a></p>
    253 </blockquote>
    254 <h4 class="mansect"><a name="tag_20_33_21" id="tag_20_33_21"></a>CHANGE HISTORY</h4>
    255 <blockquote>
    256 <p>First released in Issue 2.</p>
    257 </blockquote>
    258 <h4 class="mansect"><a name="tag_20_33_22" id="tag_20_33_22"></a>Issue 6</h4>
    259 <blockquote>
    260 <p>This utility is marked as part of the User Portability Utilities option.</p>
    261 </blockquote>
    262 <h4 class="mansect"><a name="tag_20_33_23" id="tag_20_33_23"></a>Issue 7</h4>
    263 <blockquote>
    264 <p>Austin Group Interpretation 1003.1-2001 #099 is applied.</p>
    265 <p>The <i>df</i> utility is removed from the User Portability Utilities option. User Portability Utilities is now an option for
    266 interactive utilities.</p>
    267 <p>SD5-XCU-ERN-97 is applied, updating the SYNOPSIS.</p>
    268 <p>POSIX.1-2008, Technical Corrigendum 1, XCU/TC1-2008/0082 [156] is applied.</p>
    269 </blockquote>
    270 <h4 class="mansect"><a name="tag_20_33_24" id="tag_20_33_24"></a>Issue 8</h4>
    271 <blockquote>
    272 <p>Austin Group Defect 251 is applied, encouraging implementations to report an error if a utility is directed to display a
    273 pathname that contains any bytes that have the encoded value of a &lt;newline&gt; character when &lt;newline&gt; is a terminator or
    274 separator in the output format being used.</p>
    275 <p>Austin Group Defect 1122 is applied, changing the description of <i>NLSPATH .</i></p>
    276 </blockquote>
    277 <div class="box"><em>End of informative text.</em></div>
    278 <hr>
    279 <p>&nbsp;</p>
    280 <a href="#top"><span class="topOfPage">return to top of page</span></a><br>
    281 <hr size="2" noshade>
    282 <center><font size="2">UNIX® is a registered Trademark of The Open Group.<br>
    283 POSIX™ is a Trademark of The IEEE.<br>
    284 Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved<br>
    285 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
    286 "../functions/contents.html">XSH</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../xrat/contents.html">XRAT</a>
    287 ]</font></center>
    288 <hr size="2" noshade>
    289 <div class="NAVHEADER">
    290 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
    291 <tr class="nav">
    292 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/delta.html" accesskey="P">&lt;&lt;&lt;
    293 Previous</a></td>
    294 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
    295 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/diff.html" accesskey="N">Next &gt;&gt;&gt;</a></td>
    296 </tr>
    297 </table>
    298 <hr align="left" width="100%"></div>
    299 </body>
    300 </html>