📄 output
字号:
<!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>TheSingleUNIX®Specification,Version2<br>Copyright©1997TheOpenGroup</font></center><hr size=2 noshade><h4><a name = "tag_001_014_1289"> </a>NAME</h4><blockquote>ls-listdirectorycontents</blockquote><h4><a name = "tag_001_014_1290"> </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"> </a>DESCRIPTION</h4><blockquote>Foreachoperandthatnamesafileofatypeotherthandirectory,<i>ls</i>writesthenameofthefileaswellasanyrequested,associatedinformation.Foreachoperandthatnamesafileoftypedirectory,<i>ls</i>writesthenamesoffilescontainedwithinthatdirectory,aswellasanyrequested,associatedinformation.<p>Ifnooperandsarespecified,thecontentsofthecurrentdirectoryarewritten.Ifmorethanoneoperandisspecified,non-directoryoperandsarewrittenfirst;directoryandnon-directoryoperandsaresortedseparatelyaccordingtothecollatingsequenceinthecurrentlocale.</blockquote><h4><a name = "tag_001_014_1292"> </a>OPTIONS</h4><blockquote>The<i>ls</i>utilitysupportsthe<b>XBD</b>specification,<a href="../xbd/utilconv.html#usg"><b>UtilitySyntaxGuidelines</b> </a>.<p>Thefollowingoptionsaresupported:<dl compact><br><dt><b>-C</b><dd>Writemulti-text-columnoutputwithentriessorteddownthecolumns,accordingtothecollatingsequence.Thenumberoftextcolumnsandthecolumnseparatorcharactersareunspecified,butshouldbeadaptedtothenatureoftheoutputdevice.<br><dt><b>-F</b><dd>Writeaslash(/)immediatelyaftereachpathnamethatisadirectory,anasterisk(*)aftereachthatisexecutable,andaverticalbar(|)aftereachthatisaFIFO.Forotherfiletypes,othersymbolsmaybewritten.<br><dt><b>-R</b><dd>Recursivelylistsubdirectoriesencountered.<br><dt><b>-a</b><dd>Writeoutalldirectoryentries,includingthosewhosenamesbeginwithaperiod(.).Entriesbeginningwithaperiodwillnotbewrittenoutunlessexplicitlyreferenced,the<b>-a</b>optionissupplied,oranimplementation-dependentconditioncausesthemtobewritten.<br><dt><b>-c</b><dd>Usetimeoflastmodificationofthefilestatusinformation(see<i><a href="../xsh/sysstat.h.html"><sys/stat.h></a></i>inthe<b>XSH</b>specification)insteadoflastmodificationofthefileitselfforsorting(<b>-t</b>)orwriting(<b>-l</b>).<br><dt><b>-d</b><dd>Donottreatdirectoriesdifferentlyfromothertypesoffiles.Theuseof<b>-d</b>with<b>-R</b>producesunspecifiedresults.<br><dt><b>-f</b><dd>Forceeachargumenttobeinterpretedasadirectoryandlistthenamefoundineachslot.Thisoptionturnsoff<b>-l</b>,<b>-t</b>,<b>-s</b>and<b>-r</b>,andturnson<b>-a</b>;theorderistheorderinwhichentriesappearinthedirectory.<br><dt><b>-g</b><dd>Thesameas<b>-l</b>,exceptthattheownerisnotwritten.<br><dt><b>-i</b><dd>Foreachfile,writethefile'sfileserialnumber(see<i><a href="../xsh/stat.html">stat()</a></i>inthe<b>XSH</b>specification).<br><dt><b>-l</b><dd>(Theletterell.)Writeoutinlongformat(seetheSTDOUTsection).When<b>-l</b>(ell)isspecified,<b>-1</b>(one)isassumed.<br><dt><b>-m</b><dd>Streamoutputformat;listfilesacrossthepage,separatedbycommas.<br><dt><b>-n</b><dd>Thesameas<b>-l</b>,exceptthattheowner'sUIDandGIDnumbersarewritten,ratherthantheassociatedcharacterstrings.<br><dt><b>-o</b><dd>Thesameas<b>-l</b>,exceptthatthegroupisnotwritten.<br><dt><b>-p</b><dd>Writeaslash(/)aftereachfilenameifthatfileisadirectory.<br><dt><b>-q</b><dd>Forceeachinstanceofnon-printablefilenamecharactersandtabcharacterstobewrittenasthequestion-mark(?)character.Implementationsmayprovidethisoptionbydefaultiftheoutputistoaterminaldevice.<br><dt><b>-r</b><dd>Reversetheorderofthesorttogetreversecollatingsequenceoroldestfirst.<br><dt><b>-s</b><dd>Indicatethetotalnumberoffilesystemblocksconsumedbyeachfiledisplayed.Theblocksizeisimplementation-dependent.<br><dt><b>-t</b><dd>Sortbytimemodified(mostrecentlymodifiedfirst)beforesortingtheoperandsbythecollatingsequence.<br><dt><b>-u</b><dd>Usetimeoflastaccess(see<i><a href="../xsh/sysstat.h.html"><sys/stat.h></a></i>inthe<b>XSH</b>specification)insteadoflastmodificationofthefileforsorting(<b>-t</b>)orwriting(<b>-l</b>).<br><dt><b>-x</b><dd>Thesameas<b>-C</b>,exceptthatthemulti-text-columnoutputisproducedwithentriessortedacross,ratherthandown,thecolumns.<br><dt><b>-1</b><dd>(Thenumericdigitone.)Forceoutputtobeoneentryperline.</dl><p>Specifyingmorethanoneoftheoptionsinthefollowingmutuallyexclusivepairsisnotconsideredanerror:<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>.Thelastoptionspecifiedineachpairdeterminestheoutputformat.</blockquote><h4><a name = "tag_001_014_1293"> </a>OPERANDS</h4><blockquote>Thefollowingoperandissupported:<dl compact><dt><i>file</i><dd>Apathnameofafiletobewritten.Ifthefilespecifiedisnotfound,adiagnosticmessagewillbeoutputonstandarderror.</dl></blockquote><h4><a name = "tag_001_014_1294"> </a>STDIN</h4><blockquote>Notused.</blockquote><h4><a name = "tag_001_014_1295"> </a>INPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_1296"> </a>ENVIRONMENT VARIABLES</h4><blockquote>Thefollowingenvironmentvariablesaffecttheexecutionof<i>ls</i>:<dl compact><dt><i>COLUMNS</i><dd><font color=green size=-2>deleted text:</font><strike><br></strike>Determinetheuser'spreferredcolumnpositionwidthforwritingmultipletext-columnoutput.Ifthisvariablecontainsastringrepresentingadecimalinteger,the<i>ls</i>utilitycalculateshowmanypathnametextcolumnstowrite(see<b>-C</b>)basedonthewidthprovided.If<i>COLUMNS</i>isnotsetorinvalid,animplementation-dependentnumberofcolumnpositionsisassumed,basedontheimplementation'sknowledgeoftheoutputdevice.Thecolumnwidthchosentowritethenamesoffilesinanygivendirectorywillbeconstant.Filenameswillnotbetruncatedtofitintothemultipletext-columnoutput.<dt><i>LANG</i><dd>Provideadefaultvaluefortheinternationalisationvariablesthatareunsetornull.If<i>LANG</i>isunsetornull,thecorrespondingvaluefromtheimplementation-dependentdefaultlocalewillbeused.Ifanyoftheinternationalisationvariablescontainsaninvalidsetting,theutilitywillbehaveasifnoneofthevariableshadbeendefined.<dt><i>LC_ALL</i><dd><font color=green size=-2>deleted text:</font><strike><br></strike>Ifsettoanon-emptystringvalue,overridethevaluesofalltheotherinternationalisationvariables.<dt><i>LC_COLLATE</i><dd><font color=green size=-2>deleted text:</font><strike><br></strike>Determinethelocaleforcharactercollationinformationindeterminingthepathnamecollationsequence.<dt><i>LC_CTYPE</i><dd><font color=green size=-2>deleted text:</font><strike><br></strike>Determinethelocalefortheinterpretationofsequencesofbytesoftextdataascharacters(forexample,single-versusmulti-bytecharactersinarguments)andwhichcharactersaredefinedasprintable(characterclass<b>print</b>).<dt><i>LC_MESSAGES</i><dd><font color=green size=-2>deleted text:</font><strike><br></strike>Determinethelocalethatshouldbeusedtoaffecttheformatandcontentsofdiagnosticmessageswrittentostandarderror.<dt><i>LC_TIME</i><dd><font color=green size=-2>deleted text:</font><strike><br></strike>Determinetheformatandcontentsfordateandtimestringswrittenby<i>ls</i>.<dt><i>NLSPATH</i><dd><font color=green size=-2>deleted text:</font><strike><br></strike>Determinethelocationofmessagecataloguesfortheprocessingof<i>LC_MESSAGES.</i><dt><i>TZ</i><dd>Determinethetimezonefordateandtimestringswrittenby<i>ls</i>.</dl></blockquote><h4><a name = "tag_001_014_1297"> </a>ASYNCHRONOUS EVENTS</h4><blockquote>Default.</blockquote><h4><a name = "tag_001_014_1298"> </a>STDOUT</h4><blockquote>Thedefaultformatistolistoneentryperlinetostandardoutput;theexceptionsaretoterminalsorwhenoneofthe<b>-C</b>,<b>-m</b>or<b>-x</b>optionsisspecified.Iftheoutputistoaterminal,theformatisimplementation-dependent.<p>When<b>-m</b>isspecified,theformatusedis:<p><code>'-1n'<tt>"%s,%s,...\n"</tt>,<<i>filename1</i>>,<<i>filename2</i>></code>wherethelargestnumberoffilenamesiswrittenwithoutexceedingthelengthoftheline.<p>Ifthe<b>-i</b>optionisspecified,thefile'sfileserialnumber(see<i><a href="../xsh/sysstat.h.html"><sys/stat.h></a></i>inthe<b>XSH</b>specification)iswritteninthefollowingformatbeforeanyotheroutputforthecorrespondingentry:<p><code><tt>"%u"</tt>,<<i>fileserialnumber</i>></code><p>Ifthe<b>-l</b>optionisspecified,thefollowinginformationwillbewritten:<p><code><pre><tt>"%s %u %s %s %u %s %s\n"</tt>, <<i>file mode</i>>,<<i>number of links</i>>,<<i>owner name</i>>,<<i>group name</i>>,<<i>number of bytes in the file</i>>,<<i>date and time</i>>,<<i>pathname</i>><br></pre></code><p>The<b>-g</b>,<b>-n</b>and<b>-o</b>optionsusethesameformatas<b>-l</b>,butwithomitteditemsandtheirassociatedblankcharacters;seetheOPTIONSsection.<p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -