⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ls.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!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-2003 The Open Group, All Rights Reserved --><title>ls</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="ls"></a> <a name="tag_04_81"></a><!-- ls --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright &copy; 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_04_81_01"></a>NAME</h4><blockquote>ls - list directory contents</blockquote><h4><a name="tag_04_81_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><p><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> ls</tt> <b>[</b><tt>-CFRacdilqrtu1</tt><b>][</b><tt>-H | -L</tt><b>]<img src="../images/opt-start.gif" border="0">[</b><tt>-fgmnopsx</tt><b>]<img src="../images/opt-end.gif" border="0">[</b><i>file</i><tt>...</tt><b>]</b></code></p></blockquote><h4><a name="tag_04_81_03"></a>DESCRIPTION</h4><blockquote><p>For each operand that names a file of a type other than directory or symbolic link to a directory, <i>ls</i> shall write thename of the file as well as any requested, associated information. For each operand that names a file of type directory, <i>ls</i>shall write the names of files contained within the directory as well as any requested, associated information. If one of the<b>-d</b>, <b>-F</b>, or <b>-l</b> options are specified, and one of the <b>-H</b> or <b>-L</b> options are not specified, for eachoperand that names a file of type symbolic link to a directory, <i>ls</i> shall write the name of the file as well as anyrequested, associated information. If none of the <b>-d</b>, <b>-F</b>, or <b>-l</b> options are specified, or the <b>-H</b> or<b>-L</b> options are specified, for each operand that names a file of type symbolic link to a directory, <i>ls</i> shall write thenames of files contained within the directory as well as any requested, associated information.</p><p>If no operands are specified, <i>ls</i> shall write the contents of the current directory. If more than one operand isspecified, <i>ls</i> shall write non-directory operands first; it shall sort directory and non-directory operands separatelyaccording to the collating sequence in the current locale.</p><p>The <i>ls</i> utility shall detect infinite loops; that is, entering a previously visited directory that is an ancestor of thelast file encountered. When it detects an infinite loop, <i>ls</i> shall write a diagnostic message to standard error and shalleither recover its position in the hierarchy or terminate.</p></blockquote><h4><a name="tag_04_81_04"></a>OPTIONS</h4><blockquote><p>The <i>ls</i> utility shall conform to the Base Definitions volume of IEEE&nbsp;Std&nbsp;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>-C</b></dt><dd>Write multi-text-column output with entries sorted down the columns, according to the collating sequence. The number of textcolumns and the column separator characters are unspecified, but should be adapted to the nature of the output device.</dd><dt><b>-F</b></dt><dd>Do not follow symbolic links named as operands unless the <b>-H</b> or <b>-L</b> options are specified. Write a slash (<tt>'/'</tt> ) immediately after each pathname that is a directory, an asterisk ( <tt>'*'</tt> ) after each that is executable, avertical bar ( <tt>'|'</tt> ) after each that is a FIFO, and an at sign ( <tt>'@'</tt> ) after each that is a symbolic link. Forother file types, other symbols may be written.</dd><dt><b>-H</b></dt><dd>If a symbolic link referencing a file of type directory is specified on the command line, <i>ls</i> shall evaluate the fileinformation and file type to be those of the file referenced by the link, and not the link itself; however, <i>ls</i> shall writethe name of the link itself and not the file referenced by the link.</dd><dt><b>-L</b></dt><dd>Evaluate the file information and file type for all symbolic links (whether named on the command line or encountered in a filehierarchy) to be those of the file referenced by the link, and not the link itself; however, <i>ls</i> shall write the name of thelink itself and not the file referenced by the link. When <b>-L</b> is used with <b>-l</b>, write the contents of symbolic links inthe long format (see the STDOUT section).</dd><dt><b>-R</b></dt><dd>Recursively list subdirectories encountered.</dd><dt><b>-a</b></dt><dd>Write out all directory entries, including those whose names begin with a period ( <tt>'.'</tt> ). Entries beginning with aperiod shall not be written out unless explicitly referenced, the <b>-a</b> option is supplied, or an implementation-definedcondition shall cause them to be written.</dd><dt><b>-c</b></dt><dd>Use time of last modification of the file status information (see <a href="../basedefs/sys/stat.h.html"><i>&lt;sys/stat.h&gt;</i></a> in the System Interfaces volume of IEEE&nbsp;Std&nbsp;1003.1-2001)instead of last modification of the file itself for sorting ( <b>-t</b>) or writing ( <b>-l</b>).</dd><dt><b>-d</b></dt><dd>Do not follow symbolic links named as operands unless the <b>-H</b> or <b>-L</b> options are specified. Do not treatdirectories differently than other types of files. The use of <b>-d</b> with <b>-R</b> produces unspecified results.</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">Force each argument to be interpreted as a directory and list the name found in each slot. This option shall turn off <b>-l</b>,<b>-t</b>, <b>-s</b>, and <b>-r</b>, and shall turn on <b>-a</b>; the order is the order in which entries appear in the directory.<img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt><b>-g</b></dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">The same as <b>-l</b>, except that the owner shall not be written. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt><b>-i</b></dt><dd>For each file, write the file's file serial number (see <a href="../functions/stat.html"><i>stat</i>()</a> in the SystemInterfaces volume of IEEE&nbsp;Std&nbsp;1003.1-2001).</dd><dt><b>-l</b></dt><dd>(The letter ell.) Do not follow symbolic links named as operands unless the <b>-H</b> or <b>-L</b> options are specified. Writeout in long format (see the STDOUT section). When <b>-l</b> (ell) is specified, -1 (one) shall be assumed.</dd><dt><b>-m</b></dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Stream output format; list files across the page, separated by commas. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt><b>-n</b></dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">The same as <b>-l</b>, except that the owner's UID and GID numbers shall be written, rather than the associated character strings.<img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt><b>-o</b></dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">The same as <b>-l</b>, except that the group shall not be written. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt><b>-p</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 a slash ( <tt>'/'</tt> ) after each filename if that file is a directory. <img src="../images/opt-end.gif" alt="[Option End]"border="0"></dd><dt><b>-q</b></dt><dd>Force each instance of non-printable filename characters and &lt;tab&gt;s to be written as the question-mark ( <tt>'?'</tt> )character. Implementations may provide this option by default if the output is to a terminal device.</dd><dt><b>-r</b></dt><dd>Reverse the order of the sort to get reverse collating sequence or oldest first.</dd><dt><b>-s</b></dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Indicate the total number of file system blocks consumed by each file displayed. The block size is implementation-defined. <imgsrc="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt><b>-t</b></dt><dd>Sort with the primary key being time modified (most recently modified first) and the secondary key being filename in thecollating sequence.</dd><dt><b>-u</b></dt><dd>Use time of last access (see <a href="../basedefs/sys/stat.h.html"><i>&lt;sys/stat.h&gt;</i></a>) instead of last modificationof the file for sorting ( <b>-t</b>) or writing ( <b>-l</b>).</dd><dt><b>-x</b></dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">The same as <b>-C</b>, except that the multi-text-column output is produced with entries sorted across, rather than down, thecolumns. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt><b>-1</b></dt><dd>(The numeric digit one.) Force output to be one entry per line.</dd></dl><p>Specifying more than one of the options in the following mutually-exclusive pairs shall not be considered an error: <b>-C</b>and <b>-l</b> (ell), <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> <b>-m</b> and <b>-l</b> (ell), <b>-x</b> and <b>-l</b> (ell), <img src="../images/opt-end.gif" alt="[Option End]" border="0"> <b>-C</b> and <b>-1</b> (one), <b>-H</b> and <b>-L</b>, <b>-c</b> and <b>-u</b>. The last optionspecified in each pair shall determine the output format.</p></blockquote><h4><a name="tag_04_81_05"></a>OPERANDS</h4><blockquote><p>The following operand shall be supported:</p><dl compact><dt><i>file</i></dt><dd>A pathname of a file to be written. If the file specified is not found, a diagnostic message shall be output on standarderror.</dd></dl></blockquote><h4><a name="tag_04_81_06"></a>STDIN</h4><blockquote><p>Not used.</p></blockquote><h4><a name="tag_04_81_07"></a>INPUT FILES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_81_08"></a>ENVIRONMENT VARIABLES</h4><blockquote><p>The following environment variables shall affect the execution of <i>ls</i>:</p><dl compact><dt><i>COLUMNS</i></dt><dd>Determine the user's preferred column position width for writing multiple text-column output. If this variable contains astring representing a decimal integer, the <i>ls</i> utility shall calculate how many pathname text columns to write (see<b>-C</b>) based on the width provided. If <i>COLUMNS</i> is not set or invalid, an implementation-defined number of columnpositions shall be assumed, based on the implementation's knowledge of the output device. The column width chosen to write thenames of files in any given directory shall be constant. Filenames shall not be truncated to fit into the multiple text-columnoutput.</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&nbsp;Std&nbsp;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_COLLATE</i></dt><dd><br>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -