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

📄 ls.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>ls</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_001_014_1289">&nbsp;</a>NAME</h4><blockquote>ls - list directory contents</blockquote><h4><a name = "tag_001_014_1290">&nbsp;</a>SYNOPSIS</h4><blockquote><pre><code>ls <b>[</b>-CFRacdilqrtu1<b>][</b>-fgmnopsx<b>][</b><i>file</i>...<b>]</b></code></pre></blockquote><h4><a name = "tag_001_014_1291">&nbsp;</a>DESCRIPTION</h4><blockquote>For each operand that names a file of a type other than directory,<i>ls</i>writes the name of the fileas well as any requested, associated information.For each operand that names a file of type directory,<i>ls</i>writes thenames of files contained within that directory, as well as any requested,associated information.<p>If no operands are specified,the contents of the current directory are written.If more than one operand is specified, non-directory operandsare written first; directory and non-directory operands are sortedseparately according to the collating sequence in the current locale.</blockquote><h4><a name = "tag_001_014_1292">&nbsp;</a>OPTIONS</h4><blockquote>The<i>ls</i>utility supports the <b>XBD</b> specification, <a href="../xbd/utilconv.html#usg"><b>Utility Syntax Guidelines</b>&nbsp;</a> .<p>The following options are supported:<dl compact><dt><b>-C</b><dd>Write multi-text-column output with entries sorted down the columns,according to the collating sequence.The number of text columns andthe column separator characters are unspecified, but should beadapted to the nature of the output device.<dt><b>-F</b><dd>Write a slash(/)immediately after each pathname that is a directory,an asterisk(*)after each that is executable,and a vertical bar(|)after each that is a FIFO.For other file types, other symbols may be written.<dt><b>-R</b><dd>Recursively list subdirectories encountered.<dt><b>-a</b><dd>Write out all directory entries,including those whose names begin with a period(.).Entries beginning with a periodwill not be written out unlessexplicitly referenced, the<b>-a</b>option is supplied, or animplementation-dependent condition causes them to be written.<dt><b>-c</b><dd>Use time of last modification of the file status information(see<i><a href="../xsh/sysstat.h.html">&lt;sys/stat.h&gt;</a></i>in the <b>XSH</b> specification)instead of last modification of the file itself for sorting(<b>-t</b>)or writing(<b>-l</b>).<dt><b>-d</b><dd>Do not treat directories differently fromother types of files.The use of<b>-d</b>with<b>-R</b>produces unspecified results.<dt><b>-f</b><dd>Force each argument to be interpreted as a directoryand list the name found in each slot.This option turns off<b>-l</b>,<b>-t</b>,<b>-s</b>and<b>-r</b>,and turns on<b>-a</b>;the order is the order in which entries appear in the directory.<dt><b>-g</b><dd>The same as<b>-l</b>,except that the owner is not written.<dt><b>-i</b><dd>For each file, write the file's file serial number (see<i><a href="../xsh/stat.html">stat()</a></i>in the <b>XSH</b> specification).<dt><b>-l</b><dd>(The letter ell.)Write out in long format (see the STDOUT section).When<b>-l</b>(ell) is specified,<b>-1</b>(one) is assumed.<dt><b>-m</b><dd>Stream output format;list files across the page, separated by commas.<dt><b>-n</b><dd>The same as<b>-l</b>,except that the owner's UID and GIDnumbers are written, rather than the associated character strings.<dt><b>-o</b><dd>The same as<b>-l</b>,except that the group is not written.<dt><b>-p</b><dd>Write a slash(/)after each filename if that file is a directory.<dt><b>-q</b><dd>Force each instance of non-printable filename characters andtab charactersto be written as the question-mark(?)character.Implementations may provide this option by default if the outputis to a terminal device.<dt><b>-r</b><dd>Reverse the order of the sort to get reverse collating sequenceor oldest first.<dt><b>-s</b><dd>Indicate the total number of file system blocks consumedby each file displayed.The block size is implementation-dependent.<dt><b>-t</b><dd>Sort by time modified (most recently modified first) beforesorting the operands by the collating sequence.<dt><b>-u</b><dd>Use time of last access (see<i><a href="../xsh/sysstat.h.html">&lt;sys/stat.h&gt;</a></i>in the <b>XSH</b> specification)instead of last modification of the file for sorting(<b>-t</b>)or writing(<b>-l</b>).<dt><b>-x</b><dd>The same as<b>-C</b>,except that themulti-text-column output is produced withentries sorted across, rather than down, the columns.<dt><b>-1</b><dd>(The numeric digit one.)Force output to be one entry per line.</dl><p>Specifying more than one of the options in the followingmutually exclusive pairs is not considered an error:<b>-C</b>and<b>-l</b>(ell),<b>-m</b>and<b>-l</b>(ell),<b>-x</b>and<b>-l</b>(ell),<b>-C</b>and<b>-1</b>(one),<b>-c</b>and<b>-u</b>.The last option specified in each pair determines the output format.</blockquote><h4><a name = "tag_001_014_1293">&nbsp;</a>OPERANDS</h4><blockquote>The following operand is supported:<dl compact><dt><i>file</i><dd>A pathname of a file to be written.If the file specified is not found,a diagnostic message will be output on standard error.</dl></blockquote><h4><a name = "tag_001_014_1294">&nbsp;</a>STDIN</h4><blockquote>Not used.</blockquote><h4><a name = "tag_001_014_1295">&nbsp;</a>INPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_1296">&nbsp;</a>ENVIRONMENT VARIABLES</h4><blockquote>The following environment variables affect the execution of<i>ls</i>:<dl compact><dt><i>COLUMNS</i><dd>Determine the user's preferred column position widthfor writing multiple text-column output.If this variable contains a string representing a decimal integer,the<i>ls</i>utility calculates 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-dependentnumber of column positionsis assumed, based on the implementation's knowledge of theoutput device.The column width chosen to write the names of files in any givendirectory will be constant.Filenames will not be truncatedto fit into the multiple text-column output.<dt><i>LANG</i><dd>Provide a default value for the internationalisation variablesthat are unset or null.If<i>LANG</i>is unset or null, the corresponding value from theimplementation-dependent default locale will be used.If any of the internationalisation variables contains an invalid setting, theutility will behave as if none of the variables had been defined.<dt><i>LC_ALL</i><dd>If set to a non-empty string value,override the values of all the other internationalisation variables.<dt><i>LC_COLLATE</i><dd>Determine thelocale for character collation information indetermining the pathname collation sequence.<dt><i>LC_CTYPE</i><dd>Determine thelocale for the interpretation of sequences of bytes of text data ascharacters (for example, single-versus multi-byte characters in arguments)and which characters are defined asprintable (character class<b>print</b>).<dt><i>LC_MESSAGES</i><dd>Determine the locale that should be used to affectthe format and contents of diagnosticmessages written to standard error.<dt><i>LC_TIME</i><dd>Determine the format and contents for date and time strings written by<i>ls</i>.<dt><i>NLSPATH</i><dd>Determine the location of message cataloguesfor the processing of<i>LC_MESSAGES .</i><dt><i>TZ</i><dd>Determine the timezone for date and time strings written by<i>ls</i>.</dl></blockquote><h4><a name = "tag_001_014_1297">&nbsp;</a>ASYNCHRONOUS EVENTS</h4><blockquote>Default.</blockquote><h4><a name = "tag_001_014_1298">&nbsp;</a>STDOUT</h4><blockquote>The default format is to list one entry per line to standardoutput; the exceptions are to terminals or when one of the<b>-C</b>,<b>-m</b>or<b>-x</b>options is specified.If the output is to a terminal, the format is implementation-dependent.<p>When<b>-m</b>is specified, the format used is:<p><code>'-1n'<tt>"%s, %s, ...\n"</tt>, &lt;<i>filename1</i>&gt;,&lt;<i>filename2</i>&gt;</code>where the largest number of filenames is written withoutexceeding the length of the line.<p>If the<b>-i</b>option is specified, the file's file serial number (see<i><a href="../xsh/sysstat.h.html">&lt;sys/stat.h&gt;</a></i>in the <b>XSH</b> specification)is written in the following formatbefore any other output for the corresponding entry:<p><code><tt>"%u "</tt>, &lt;<i>file serial number</i>&gt;</code><p>If the<b>-l</b>option is specified, the following informationwill be written:<p><code><tt>"%s %u %s %s %u %s %s\n"</tt>, &lt;<i>file&nbsp;mode</i>&gt;,&lt;<i>number&nbsp;of&nbsp;links</i>&gt;,&lt;<i>owner&nbsp;name</i>&gt;,&lt;<i>group&nbsp;name</i>&gt;,&lt;<i>number&nbsp;of&nbsp;bytes&nbsp;in&nbsp;the&nbsp;file</i>&gt;,&lt;<i>date&nbsp;and&nbsp;time</i>&gt;,&lt;<i>pathname</i>&gt;<br></code><p>The<b>-g</b>,<b>-n</b>and<b>-o</b>options use the same format as<b>-l</b>,but with omitted items and their associatedblank characters;see the OPTIONS section.<p>If&lt;<i>owner name</i>&gt;or&lt;<i>group name</i>&gt;cannot be determined,

⌨️ 快捷键说明

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