📄 output
字号:
If<<i>ownername</i>>or<<i>groupname</i>>cannotbedetermined,orif<b>-n</b>isgiven,theyarereplacedwiththeirassociatednumericvaluesusingtheformat%u.<p>The<<i>dateandtime</i>>,fieldwillcontaintheappropriatedateandtimestampofwhenthefilewaslastmodified.InthePOSIXlocale,thefieldistheequivalentoftheoutputofthefollowing<i><a href="date.html">date</a></i>command:<pre><code>date "+%b %e %H:%M"</code></pre>ifthefilehasbeenmodifiedinthelastsixmonths,or:<pre><code>date "+%b %e %Y"</code></pre>(wheretwospacecharactersareusedbetween<b>%e</b>and<b>%Y)</b>ifthefilehasnotbeenmodifiedinthelastsixmonthsorifthemodificationdateisinthefuture,exceptthat,inbothcases,thefinalnewlinecharacterproducedby<i><a href="date.html">date</a></i>isnotincludedandtheoutputisasifthe<i><a href="date.html">date</a></i>commandwereexecutedatthetimeofthelastmodificationdateofthefileratherthanthecurrenttime.WhentheLC_TIMElocalecategoryisnotsettothePOSIXlocale,adifferentformatandorderofpresentationofthisfieldmaybeused.<p>Ifthefileisacharacterspecialorblockspecialfile,thesizeofthefilemaybereplacedwithimplementation-dependentinformationassociatedwiththedeviceinquestion.<p>Ifthepathnamewasspecifiedasa<i>file</i>operand,itwillbewrittenasspecified.<p>Thefilemodewrittenunderthe<b>-l</b>,<b>-g</b>,<b>-n</b>and<b>-o</b>optionsconsistsofthefollowingformat:<p><code><pre><tt>"%c%s%s%s%c"</tt>, <<i>entry type</i>>,<<i>owner permissions</i>>,<<i>group permissions</i>>,<<i>other permissions</i>>,<<i>optional alternate access method flag</i>></pre></code><p>The<<i>optionalalternateaccessmethodflag</i>>isasinglespacecharacterifthereisnoalternateoradditionalaccesscontrolmethodassociatedwiththefile;otherwise,aprintablecharacterisused.<p>The<<i>entrytype</i>>characterdescribesthetypeoffile,asfollows:<dl compact><dt>d<dd>Directory.<dt>b<dd>Blockspecialfile.<dt>c<dd>Characterspecialfile.<dt>p<dd>FIFO.<dt>-<dd>Regularfile.</dl><p>Implementationsmayaddothercharacterstothislisttorepresentother,implementation-dependent,filetypes.<p>Thenextthreefieldsarethreecharacterseach:<dl compact><dt><<i>ownerpermissions</i>><dd><font color=green size=-2>deleted text:</font><strike><br></strike>Permissionsforthefileownerclass(see<b>fileaccesspermissions</b>inthe<b>XBD</b>specification,<a href="../xbd/glossary.html"><b>Glossary</b> </a>).<dt><<i>grouppermissions</i>><dd><font color=green size=-2>deleted text:</font><strike><br></strike>Permissionsforthefilegroupclass.<dt><<i>otherpermissions</i>><dd><font color=green size=-2>deleted text:</font><strike><br></strike>Permissionsforthefileotherclass.</dl><p>Eachfieldhasthreecharacterpositions:<ol><p><li>Ifr,thefileisreadable;if"-",itisnotreadable.<p><li>Ifw,thefileiswritable;if"-",itisnotwritable.<p><li>Thefirstofthefollowingthatapplies:<dl compact><dt><b>S</b><dd>Ifin<<i>ownerpermissions</i>>,thefileisnotexecutableandset-user-IDmodeisset.Ifin<<i>grouppermissions</i>>,thefileisnotexecutableandset-group-IDmodeisset.<dt><b>s</b><dd>Ifin<<i>ownerpermissions</i>>,thefileisexecutableandset-user-IDmodeisset.Ifin<<i>grouppermissions</i>>,thefileisexecutableandset-group-IDmodeisset.<dt><b>x</b><dd>Thefileisexecutableorthedirectoryissearchable.<dt><b>-</b><dd>NoneoftheattributesofS,sorxapplies.</dl><p>Implementationsmayaddothercharacterstothislistforthethirdcharacterposition.Suchadditionswill,however,bewritteninlower-caseifthefileisexecutableorsearchable,andinupper-caseifitisnot.<p></ol><p>Ifanyofthe<b>-l</b>,<b>-g</b>,<b>-n</b>,<b>-o</b>or<b>-s</b>optionsisspecified,eachlistoffileswithinthedirectorywillbeprecededbyastatuslineindicatingthenumberoffilesystemblocksoccupiedbyfilesinthedirectoryin512-byteunits,roundeduptothenextintegralnumberofunits,ifnecessary.InthePOSIXlocale,theformatis:<p><code><pre><tt>"total %u\n"</tt>, <<i>number of units in the directory</i>></pre></code><p>Ifmorethanonedirectory,oracombinationofnon-directoryfilesanddirectoriesarewritten,eitherasaresultofspecifyingmultipleoperands,orthe<b>-R</b>option,eachlistoffileswithinadirectorywillbeprecededby:<p><code><tt>"\n%s:\n"</tt>,<<i>directoryname</i>></code><p>Ifthisstringisthefirstthingtobewritten,thefirstnewlinecharacterisnotwritten.Thisoutputprecedesthenumberofunitsinthedirectory.<p>Ifthe<b>-s</b>optionisgiven,eachfileshallbewrittenwiththenumberofblocksusedbythefile.Alongwith<b>-C</b>,<b>-1</b>,<b>-m</b>or<b>-x</b>,thenumberandaspacecharacterprecedethefilename;with<b>-g</b>,<b>-l</b>,<b>-n</b>or<b>-o</b>,theyprecedeeachlinedescribingafile.</blockquote><h4><a name = "tag_001_014_1299"> </a>STDERR</h4><blockquote>Usedonlyfordiagnosticmessages.</blockquote><h4><a name = "tag_001_014_1300"> </a>OUTPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_1301"> </a>EXTENDED DESCRIPTION</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_1302"> </a>EXIT STATUS</h4><blockquote>Thefollowingexitvaluesarereturned:<dl compact><dt>0<dd>Allfileswerewrittensuccessfully.<dt>>0<dd>Anerroroccurred.</dl></blockquote><h4><a name = "tag_001_014_1303"> </a>CONSEQUENCES OF ERRORS</h4><blockquote>Default.</blockquote><h4><a name = "tag_001_014_1304"> </a>APPLICATION USAGE</h4><blockquote>Manyimplementationsusetheequalsign(=)andtheatsign(@)todenotesocketsboundtothefilesystemandsymboliclinks,respectively,forthe<b>-F</b>option.Similarly,manyhistoricalimplementationsusethescharacterandthelcharactertodenotesocketsandsymboliclinks,respectively,astheentrytypecharactersforthe<b>-l</b>option.<p>Itisdifficultforanapplicationtouseeverypartofthefilemodesfieldof<i>ls</i><b>-l</b>inaportablemanner.Certainfiletypesandexecutablebitsarenotguaranteedtobeexactlyasshown,asimplementationsmayhaveextensions.Applicationscanusethisfieldtopassdirectlytoauserprintoutorprompt,butactionsbasedonitscontentsshouldgenerallybedeferred,instead,tothe<i><a href="test.html">test</a></i>utility.<p>Theoutputof<i>ls</i>(withthe<b>-l</b>andrelatedoptions)containsinformationthatlogicallycouldbeusedbyutilitiessuchas<i><a href="chmod.html">chmod</a></i>and<i><a href="touch.html">touch</a></i>torestorefilestoaknownstate.However,thisinformationispresentedinaformatthatcannotbeuseddirectlybythoseutilitiesorbeeasilytranslatedintoaformatthatcanbeused.Acharacterhasbeenaddedtotheendofthepermissionsstringsothatapplicationswillatleasthaveanindicationthattheymaybeworkinginanareatheydonotunderstandinsteadofassumingthattheycantranslatethepermissionsstringintosomethingthatcanbeused.Futureissuesorrelateddocumentsmaydefineoneormorespecificcharacterstobeusedbasedondifferentstandardadditionaloralternativeaccesscontrolmechanisms.<p>Aswithmanyoftheutilitiesthatdealwithfilenames,theoutputof<i>ls</i>formultiplefilesorinoneofthelonglistingformatsmustbeusedcarefullyonsystemswherefilenamescancontainembeddedwhitespace.Systemsandsystemadministratorsshouldinstitutepoliciesandusertrainingtolimittheuseofsuchfilenames.<p>Thenumberofdiskblocksoccupiedbythefilethatitreportsvariesdependingonunderlyingfilesystemtype,blocksizeunitsreportedandthemethodofcalculatingthenumberofblocks.Onsomefilesystemtypes,thenumberistheactualnumberofblocksoccupiedbythefile(countingindirectblocksandignoringholesinthefile);onothersitiscalculatedbasedonthefilesize(usuallymakinganallowanceforindirectblocks,butignoringholes).</blockquote><h4><a name = "tag_001_014_1305"> </a>EXAMPLES</h4><blockquote>Anexampleofasmalldirectorytreebeingfullylistedwith<i>ls</i><b>-laRF</b><b>a</b>inthePOSIXlocale:<pre><code>total 11drwxr-xr-x 3 hlj prog 64 Jul 4 12:07 ./drwxrwxrwx 4 hlj prog 3264 Jul 4 12:09 ../drwxr-xr-x 2 hlj prog 48 Jul 4 12:07 b/-rwxr--r-- 1 hlj prog 572 Jul 4 12:07 foo*a/b:total 4drwxr-xr-x 2 hlj prog 48 Jul 4 12:07 ./drwxr-xr-x 3 hlj prog 64 Jul 4 12:07 ../-rw-r--r-- 1 hlj prog 700 Jul 4 12:07 bar</code></pre></blockquote><h4><a name = "tag_001_014_1306"> </a>FUTURE DIRECTIONS</h4><blockquote>The<b>-s</b>usesimplementation-dependentunitsandcannotbeusedportably;itmaybewithdrawninafutureissue.<p>TheIEEEPASC1003.2InterpretationsCommitteehasforwardedconcernsaboutpartsofthisinterfacedefinitiontotheIEEEPASCShellandUtilitiesWorkingGroupwhichisidentifyingthecorrections.AfuturerevisionofthisspecificationwillalignwithIEEEStd.1003.2bwhenfinalised.</blockquote><h4><a name = "tag_001_014_1307"> </a>SEE ALSO</h4><blockquote><i><a href="chmod.html">chmod</a></i>,<i><a href="find.html">find</a></i>,the<b>XSH</b>specificationdescriptionof<i><a href="../xsh/sysstat.h.html"><sys/stat.h></a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX®isaregisteredTrademarkofTheOpenGroup.<br>Copyright©1997TheOpenGroup<br>[<a href="../index.html">MainIndex</a>|<a href="../xshix.html">XSH</a>|<a href="../xcuix.html">XCU</a>|<a href="../xbdix.html">XBD</a>|<a href="../cursesix.html">XCURSES</a>|<a href="../xnsix.html">XNS</a>]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -