2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group. In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document. The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
25 .\" This notice shall appear on any product containing this material.
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
43 .\" Copyright 1989 AT&T
44 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
45 .\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved
46 .\" Copyright 2014 Nexenta Systems, Inc. All Rights Reserved.
48 .TH LS 1 "Oct 25, 2017"
50 ls \- list contents of directory
54 \fB/usr/bin/ls\fR [\fB-aAbcCdeEfFghHiklLmnopqrRsStuUwvVx1@\fR]
55 [\fB-/ c\fR | \fBv\fR] [\fB-% atime | crtime | ctime | mtime | all\fR]
56 [--block-size size] [--color[=\fIwhen\fR]] [--file-type]
57 [--si] [--time-style \fIstyle\fR] [\fIfile\fR]...
62 For each \fIfile\fR that is a directory, \fBls\fR lists the contents of the
63 directory. For each \fIfile\fR that is an ordinary file, \fBls\fR repeats its
64 name and any other information requested. The output is sorted alphabetically
65 by default. When no argument is given, the current directory (\fB\&.\fR) is
66 listed. When several arguments are given, the arguments are first sorted
67 appropriately, but file arguments appear before directories and their contents.
70 There are three major listing formats. The default format for output directed
71 to a terminal is multi\(micolumn with entries sorted down the columns. The
72 \fB-1\fR option allows single column output and \fB-m\fR enables stream output
73 format. In order to determine output formats for the \fB-C\fR, \fB-x\fR, and
74 \fB-m\fR options, \fBls\fR uses an environment variable, \fBCOLUMNS\fR, to
75 determine the number of character positions available on one output line. If
76 this variable is not set, the \fBterminfo\fR(4) database is used to determine
77 the number of columns, based on the environment variable, \fBTERM\fR. If this
78 information cannot be obtained, 80 columns are assumed. If the \fB-w\fR option
79 is used, the argument overrides any other column width.
82 The mode printed when the \fB-e\fR, \fB-E\fR, \fB-g\fR, \fB-l\fR, \fB-n\fR,
83 \fB-o\fR, \fB-v\fR, \fB-V\fR, or \fB-@\fR option is in effect consists of
84 eleven characters. The first character can be one of the following:
92 The entry is a directory.
112 The entry is a symbolic link.
122 The entry is a block special file.
132 The entry is a character special file.
142 The entry is a \fBFIFO\fR (or "named pipe") special file.
152 The entry is an event port.
162 The entry is an \fBAF_UNIX\fR address family socket.
172 The entry is an ordinary file.
177 The next 9 characters are interpreted as three sets of three bits each. The
178 first set refers to the owner's permissions; the next to permissions of others
179 in the user-group of the file; and the last to all others. Within each set, the
180 three characters indicate permission to read, to write, and to execute the file
181 as a program, respectively. For a directory, \fBexecute\fR permission is
182 interpreted to mean permission to search the directory for a specified file.
183 The character after permissions is an ACL or extended attributes indicator.
184 This character is an \fB@\fR if extended attributes are associated with the
185 file and the \fB-@\fR option is in effect. Otherwise, this character is a plus
186 sign (\fB+\fR) character if a non-trivial ACL is associated with the file or a
187 space character if not.
190 If \fB-/\fR and/or \fB-%\fR are in effect, then the extended system attributes
191 are printed when filesystem supports extended system attributes. The display
197 -rw-r--r-- 1 root root 0 May 10 14:17 file
201 -rw-r--r-- 1 root root 0 May 10 14:17 file
202 {archive,hidden,readonly,system,\e
203 appendonly,nodump,immutable,av_modified,\e
204 noav_quarantined,nounlink,nooffline,\e
208 -rw-r--r-- 1 root root 0 May 10 14:17 file
209 timestamp: atime Jun 25 12:56:44 2007
210 timestamp: ctime May 10 14:20:23 2007
211 timestamp: mtime May 10 14:17:56 2007
212 timestamp: crtime May 10 14:17:56 2007
219 See the option descriptions of the \fB-/\fR and \fB-%\fR option for details.
222 \fBls\fR \fB-l\fR (the long list) prints its output as follows for the POSIX
227 -rwxrwxrwx+ 1 smith dev 10876 May 16 9:42 part2
234 Reading from right to left, you see that the current directory holds one file,
235 named \fBpart2\fR. Next, the last time that file's contents were modified was
236 \fB9:42 A.M.\fR on \fBMay 16\fR. The file contains 10,876 characters, or bytes.
237 The owner of the file, or the user, belongs to the group \fBdev\fR (perhaps
238 indicating \fBdevelopment\fR), and his or her login name is \fBsmith\fR. The
239 number, in this case \fB1\fR, indicates the number of links to file \fBpart2\fR
240 (see \fBcp\fR(1)). The plus sign indicates that there is an \fBACL\fR
241 associated with the file. If the \fB-@\fR option has been specified, the
242 presence of extended attributes supersede the presence of an \fBACL\fR and the
243 plus sign is replaced with an 'at' sign (\fB@\fR). Finally, the dash and
244 letters tell you that user, group, and others have permissions to read, write,
245 and execute \fBpart2\fR.
248 The execute (\fBx\fR) symbol occupies the third position of the three-character
249 sequence. A \fB\(mi\fR in the third position would have indicated a denial of
250 execution permissions.
253 The permissions are indicated as follows:
261 The file is readable.
271 The file is writable.
281 The file is executable.
291 The indicated permission is \fInot\fR granted.
301 The \fBs\fRet-user-ID or \fBs\fRet-group-ID bit is on, and the corresponding
302 user or group execution bit is also on.
312 Undefined bit-state (the set-user-ID or set-group-id bit is on and the user or
313 group execution bit is off). For group permissions, this applies only to
324 The 1000 (octal) bit, or sticky bit, is on (see \fBchmod\fR(1)), and execution
335 The 1000 bit is turned on, and execution is off (undefined bit-state).
344 Mandatory locking occurs during access (on a regular file, the set-group-ID bit
345 is on and the group execution bit is off).
350 For user and group permissions, the third position is sometimes occupied by a
351 character other than \fBx\fR or \fB-\fR. \fBs\fR or \fBS\fR also can occupy
352 this position, referring to the state of the set-ID bit, whether it be the
353 user's or the group's. The ability to assume the same ID as the user during
354 execution is, for example, used during login when you begin as root but need to
355 assume the identity of the user you login as.
358 In the case of the sequence of group permissions, \fBl\fR can occupy the third
359 position. \fBl\fR refers to mandatory file and record locking. This permission
360 describes a file's ability to allow other files to lock its reading or writing
361 permissions during access.
364 For others permissions, the third position can be occupied by \fBt\fR or
365 \fBT\fR. These refer to the state of the sticky bit and execution permissions.
368 If color output is enabled, the environment variable LS_COLORS is checked. If
369 it exists, it's contents are used to control the colors used to display
370 filenames. If it is not set, a default list of colors is used. The format of
371 LS_COLORS is a colon separated list of attribute specifications. Each attribute
372 specification is of the format
376 \fIfilespec\fR=\fIattr\fR[;\fIattr\fR..]
383 \fIfilespec\fR is either of the form \fI*.SUFFIX\fR, for example, \fB*.jar\fR
384 or \fB*.Z\fR, or one of the following file types:
482 Execute bit (either \fBuser\fR, \fBgroup\fR, or \fBother\fR) set
552 Sticky bit and \fBworld\fR writable
557 \fIattr\fR is a semicolon delimited list of color and display attributes which
558 are combined to determine the final output color. Any combination of \fIattr\fR
559 values can be specified. Possible \fIattr\fR values are:
567 All attributes off (default terminal color)
587 Display text with an underscore
607 Display text with foreground and background colors reversed
617 Display using concealed text.
622 One of the following values can be chosen. If multiple values are specified,
623 the last specified value is used.
631 Set foreground to \fBblack\fR.
641 Set foreground to \fBred\fR.
651 Set foreground to \fBgreen\fR.
661 Set foreground to \fByellow\fR.
671 Set foreground to \fBblue\fR.
681 Set foreground to \fBmagenta\fR (\fBpurple\fR).
683 Set foreground to \fB\fR.
693 Set foreground to \fBcyan\fR.
703 Set foreground to \fBwhite\fR.
713 Set foreground to default terminal color.
718 One of the following can be specified. If multiple values are specified, the
719 last value specified is used.
727 Set foreground to \fBblack\fR.
737 Set foreground to \fBred\fR.
747 Set foreground to \fBgreen\fR.
757 Set foreground to \fByellow\fR.
767 Set foreground to \fBblue\fR.
777 Set foreground to \fBmagenta\fR (\fBpurple\fR).
787 Set foreground to \fBcyan\fR.
797 Set foreground to \fBwhite\fR.
807 Set foreground to default terminal color.
812 On some terminals, setting the bold attribute causes the foreground colors to
813 be high-intensity, that is, brighter. In such cases the low-intensity yellow is
814 often displayed as a brown or orange color.
817 At least one attribute must be listed for a file specification.
820 The appropriate color codes are chosen by selecting the most specific match,
821 starting with the file suffixes and proceeding with the file types until a
822 match is found. The \fBno\fR (normal file) type matches any file.
825 The following options are supported:
827 The following options are supported for all three versions:
839 Lists all entries, including those that begin with a dot (\fB\&.\fR), which are
850 \fB\fB--almost-all\fR\fR
854 Lists all entries, including those that begin with a dot (\fB\&.\fR), with the
855 exception of the working directory (\fB\&.\fR) and the parent directory
870 Forces printing of non-printable characters to be in the octal
871 \fB\e\fR\fIddd\fR notation.
881 \fB\fB--ignore-backups\fR\fR
885 Do not display any files ending with a tilde (\fB~\fR).
895 Uses time of last modification of the i-node (file created, mode changed, and
896 so forth) for sorting (\fB-t\fR) or printing (\fB-l\fR or \fB-n\fR).
906 Multi-column output with entries sorted down the columns. This is the default
917 If an argument is a directory, lists only its name (not its contents). Often
918 used with \fB-l\fR to get the status of a directory.
928 The same as \fB-l\fR, except displays time to the second, and with one format
929 for all files regardless of age: \fImmm dd hh:mm:ss yyyy\fR.
939 The same as \fB-l\fR, except displays time to the nanosecond and with one
940 format for all files regardless of age: \fIyyyy-mm-dd hh:mm:ss.nnnnnnnnn\fR
941 (ISO 8601:2000 format).
943 In addition, this option displays the offset from UTC in ISO 8601:2000 standard
944 format (+\fIhhmm\fR or -\fIhhmm\fR) or no characters if the offset is
945 indeterminable. The offset reflects the appropriate standard or alternate
946 offset in force at the file's displayed date and time, under the current
957 Forces each argument to be interpreted as a directory and list the name found
958 in each slot. This option turns off \fB-l\fR, \fB-t\fR, \fB-s\fR, \fB-S\fR, and
959 \fB-r\fR, and turns on \fB-a\fR. The order is the order in which entries appear
970 \fB\fB--classify\fR\fR
974 Append a symbol after certain types of files to indicate the file type. The
975 following symbols are used:
1003 Named pipe (\fBFIFO\fR)
1045 The same as \fB-l\fR, except that the owner is not printed.
1055 \fB\fB--human-readable\fR\fR
1059 All sizes are scaled to a human readable format, for example, \fB14K\fR,
1060 \fB234M\fR, \fB2.7G\fR, or \fB3.0T\fR. Scaling is done by repetitively dividing
1061 by \fB1024\fR. The last --si or -h option determines the divisor used.
1071 \fB\fB--dereference-command-line\fR\fR
1075 If an argument is a symbolic link that references a directory, this option
1076 evaluates the file information and file type of the directory that the link
1077 references, rather than those of the link itself. However, the name of the link
1078 is displayed, rather than the referenced directory.
1092 For each file, prints the i-node number in the first column of the report.
1102 All sizes are printed in kbytes. Equivalent to --block-size=1024.
1112 Lists in long format, giving mode, \fBACL\fR indication, number of links,
1113 owner, group, size in bytes, and time of last modification for each file (see
1114 above). If the file is a special file, the size field instead contains the
1115 major and minor device numbers. If the time of last modification is greater
1116 than six months ago, it is shown in the format `month date year' for the POSIX
1117 locale. When the \fBLC_TIME\fR locale category is not set to the POSIX locale,
1118 a different format of the time field can be used. Files modified within six
1119 months show `month date time'. If the file is a symbolic link, the filename is
1120 printed followed by "\fB\(->\fR" and the path name of the referenced file.
1130 \fB\fB--dereference\fR\fR
1134 If an argument is a symbolic link, this option evaluates the file information
1135 and file type of the file or directory that the link references, rather than
1136 those of the link itself. However, the name of the link is displayed, rather
1137 than the referenced file or directory.
1147 Streams output format. Files are listed across the page, separated by commas.
1157 \fB\fB--numeric-uid-gid\fR\fR
1161 The same as \fB-l\fR, except that the owner's \fBUID\fR and group's \fBGID\fR
1162 numbers are printed, rather than the associated character strings.
1172 \fB\fB--no-group\fR\fR
1176 The same as \fB-l\fR, except that the group is not printed.
1186 Puts a slash (\fB/\fR) after each filename if the file is a directory.
1196 \fB\fB--hide-control-chars\fR\fR
1200 Forces printing of non-printable characters in file names as the character
1201 question mark (\fB?\fR).
1211 \fB\fB--reverse\fR\fR
1215 Reverses the order of sort to get reverse alphabetic, oldest first, or smallest
1216 file size first as appropriate.
1226 \fB\fB--recursive\fR\fR
1230 Recursively lists subdirectories encountered.
1244 Indicate the total number of file system blocks consumed by each file
1255 Sort by file size (in decreasing order) and for files with the same size by
1256 file name (in increasing alphabetic order) instead of just by name.
1266 Sorts by time stamp (latest first) instead of by name. The default is the last
1267 modification time. See \fB-c\fR, \fB-u\fR and \fB-%\fR.
1277 Uses time of last access instead of last modification for sorting (with the
1278 \fB-t\fR option) or printing (with the \fB-l\fR option).
1298 The same as \fB-l\fR, except that verbose ACL information is displayed as well
1299 as the \fB-l\fR output. ACL information is displayed even if the file or
1300 directory doesn't have an ACL.
1310 The same as \fB-l\fR, except that compact ACL information is displayed after
1311 the \fB-l\fR output.
1313 The \fB-V\fR option is only applicable to file systems that support NFSv4 ACLs,
1314 such as the Solaris ZFS file system.
1316 The format of the displayed ACL is as follows:
1320 \fIentry_type\fR : \fIpermissions\fR : \fIinheritance_flags\fR : \fIaccess_type\fR
1325 \fIentry_type\fR is displayed as one of the following:
1329 \fBuser:\fIusername\fR\fR
1333 Additional user access for \fIusername\fR.
1339 \fBgroup:\fIgroupname\fR\fR
1343 Additional group access for group \fIgroupname\fR.
1373 Everyone access, including file owner and file group owner. This is not
1374 equivalent to the POSIX other class.
1377 The following permissions, supported by the NFSv4 ACL model, are displayed by
1378 using the \fB-v\fR or \fB-V\fR options:
1382 \fBread_data (\fBr\fR)\fR
1386 Permission to read the data of a file.
1392 \fBlist_directory (\fBr\fR)\fR
1396 Permission to list the contents of a directory.
1402 \fBwrite_data (\fBw\fR)\fR
1406 Permission to modify a file's data. anywhere in the file's offset range.
1412 \fBadd_file (\fBw\fR)\fR
1416 Permission to add a new file to a directory.
1422 \fBappend_data (\fBp\fR)\fR
1426 The ability to modify a file's data, but only starting at EOF.
1432 \fBadd_subdirectory (\fBp\fR)\fR
1436 Permission to create a subdirectory to a directory.
1442 \fBread_xattr (\fBR\fR)\fR
1446 Ability to read the extended attributes of a file.
1452 \fBwrite_xattr (\fBW\fR)\fR
1456 Ability to create extended attributes or write to the extended attribute
1463 \fBexecute (\fBx\fR)\fR
1467 Permission to execute a file.
1473 \fBread_attributes (\fBa\fR)\fR
1477 The ability to read basic attributes (non-ACLs) of a file.
1483 \fBwrite_attributes (\fBA\fR)\fR
1487 Permission to change the times associated with a file or directory to an
1494 \fBdelete (\fBd\fR)\fR
1498 Permission to delete a file.
1504 \fBdelete_child (\fBD\fR)\fR
1508 Permission to delete a file within a directory.
1514 \fBread_acl (\fBc\fR)\fR
1518 Permission to read the ACL of a file.
1524 \fBwrite_acl (\fBC\fR)\fR
1528 Permission to write the ACL of a file.
1534 \fBwrite_owner (\fBo\fR)\fR
1538 Permission to change the owner of a file.
1544 \fBsynchronize (\fBs\fR)\fR
1548 Permission to access file locally at server with synchronize reads and writes.
1558 No permission granted
1561 The following inheritance flags, supported by the NFSv4 ACL model, are
1562 displayed by using the \fB-v\fR or \fB-V\fR options:
1566 \fBfile_inherit (\fBf\fR)\fR
1570 Inherit to all newly created files.
1576 \fBdir_inherit (\fBd\fR)\fR
1580 Inherit to all newly created directories.
1586 \fBinherit_only (\fBi\fR)\fR
1590 When placed on a directory, do not apply to the directory, only to newly
1591 created files and directories. This flag requires that either
1592 \fBfile_inherit\fR and or \fBdir_inherit\fR is also specified.
1598 \fBno_propagate (\fBn\fR)\fR
1602 Indicates that ACL entries should be inherited to objects in a directory, but
1603 inheritance should stop after descending one level. This flag is dependent upon
1604 either \fBfile_inherit\fR and or \fBdir_inherit\fR also being specified.
1610 \fBsuccessful_access (\fBS\fR)\fR
1614 Indicates whether an alarm or audit record should be initiated upon successful
1615 accesses. Used with audit/alarm ACE types.
1621 \fBfailed_access (\fBF\fR)\fR
1625 Indicates whether an alarm or audit record should be initiated when access
1626 fails. Used with audit/alarm ACE types.
1632 \fBinherited (\fBI\fR)\fR
1646 No permission granted.
1649 \fIaccess_type\fR is displayed as one of the following types:
1656 Permission field that specifies permissions that should trigger an alarm.
1665 Permission field that specifies allow permissions.
1674 Permission field that specifies permissions that should be audited.
1683 Permission field that specifies deny permissions.
1690 $ ls -dV /sandbox/dir.1
1691 drwxr-xr-x+ 2 root root 2 Jan 17 15:09 dir.1
1692 user:marks:r-------------:fd-----:allow
1693 owner@:--------------:-------:deny
1694 owner@:rwxp---A-W-Co-:-------:allow
1695 group@:-w-p----------:-------:deny
1696 group@:r-x-----------:-------:allow
1697 everyone@:-w-p---A-W-Co-:-------:deny
1698 everyone@:r-x---a-R-c--s:-------:allow
1700 ||||||||||||||||:||||||+ inherited access
1701 ||||||||||||||:||||||+ failed access
1702 ||||||||||||||:|||||+--success access
1703 ||||||||||||||:||||+-- no propagate
1704 ||||||||||||||:|||+--- inherit only
1705 ||||||||||||||:||+---- directory inherit
1706 ||||||||||||||:|+----- file inherit
1708 ||||||||||||||+ sync
1709 |||||||||||||+- change owner
1710 ||||||||||||+-- write ACL
1711 |||||||||||+--- read ACL
1712 ||||||||||+---- write extended attributes
1713 |||||||||+----- read extended attributes
1714 ||||||||+------ write attributes
1715 |||||||+------- read attributes
1716 ||||||+-------- delete child
1717 |||||+--------- delete
1718 ||||+---------- append
1719 |||+----------- execute
1720 ||+------------ write data
1721 |+------------- read data
1731 \fB\fB-w\fR \fIcols\fR\fR
1735 \fB\fB--width\fR \fIcols\fR\fR
1739 Multi-column output where the column width is forced to \fIcols\fR.
1749 Multi-column output with entries sorted across rather than down the page.
1759 Prints one entry per line of output.
1769 The same as \fB-l\fR, except that extended attribute information overrides
1770 \fBACL\fR information. An \fB@\fR is displayed after the file permission bits
1771 for files that have extended attributes.
1777 \fB\fB-/ c\fR | \fBv\fR\fR
1781 The same as \fB-l\fR, and in addition displays the extended system attributes
1782 associated with the file when extended system attributes are fully supported by
1783 the underlying file system. The option \fB-/\fR supports two option arguments
1784 \fBc\fR (compact mode) and \fBv\fR (verbose mode).
1788 \fB\fBappendonly\fR\fR
1792 Allows a file to be modified only at offset \fBEOF\fR. Attempts to modify a
1793 file at a location other than \fBEOF\fR fails with \fBEPERM\fR.
1803 Indicates if a file has been modified since it was last backed up. Whenever the
1804 modification time (\fBmtime\fR) of a file is changed the \fBarchive\fR
1811 \fB\fBav_modified\fR\fR
1815 ZFS sets the anti-virus attribute which whenever a file's content or size
1816 changes or when the file is renamed.
1822 \fB\fBav_quarantined\fR\fR
1826 Anti-virus software sets to mark a file as quarantined.
1836 Timestamp when a file is created.
1846 Marks a file as hidden.
1852 \fB\fBimmutable\fR\fR
1856 Prevents the content of a file from being modified. Also prevents all metadata
1857 changes, except for access time updates. When placed on a directory, prevents
1858 the deletion and creation of files in the directories. Attempts to modify the
1859 content of a file or directory marked as \fBimmutable\fR fail with \fBEPERM\fR.
1860 Attempts to modify any attributes (with the exception of access time and, with
1861 the proper privileges, the \fBimmutable\fR) of a file marked as \fBimmutable\fR
1862 fails with \fBEPERM\fR.
1872 Solaris systems have no special semantics for this attribute.
1878 \fB\fBnounlink\fR\fR
1882 Prevents a file from being deleted. On a directory, the attribute also prevents
1883 any changes to the contents of the directory. That is, no files within the
1884 directory can be removed or renamed. The \fBerrno\fR \fBEPERM\fR is returned
1885 when attempting to unlink or rename files and directories that are marked as
1896 Indicate that a file is offline. Solaris systems have no special semantics for
1903 \fB\fBreadonly\fR\fR
1907 Marks a file as \fBreadonly\fR. Once a file is marked as \fBreadonly\fR the
1908 content data of the file cannot be modified. Other metadata for the file can
1919 Indicate that a file can be interpreted as sparse. It does not indicate that
1920 the file is actually sparse or not. The sparse attribute is cleared when the
1921 file is truncated to zero length. Solaris systems have no other special
1922 semantics for this attribute.
1932 Solaris systems have no special semantics for this attribute.
1939 The display characters used in compact mode (\fB-/ c\fR) are as follows:
1943 Attribute Name Display
1962 The display in verbose mode (\fB-/ v\fR) uses full attribute names when it is set and
1963 the name prefixed by 'no' when it is not set.
1966 The attribute name \fBcrtime\fR and all other timestamps are handled by the
1967 option \fB-%\fR with the respective timestamp option arguments and also with
1968 \fBall\fR option argument. The display positions are as follows: The display in
1969 verbose mode (\fB-/ v\fR) uses full attribute names when it is set and the
1970 name prefixed by \fBno\fR when it is not set. The attribute name \fBcrtime\fR
1971 and all other timestamps are handled by the option \fB-%\fR with the respective
1972 timestamp option arguments and also with \fBall\fR option argument.
1975 The display positions are as follows:
1980 |||||||||||+- s (sparse)
1981 ||||||||||+-- O (offline)
1982 |||||||||+--- u (nounlink)
1983 ||||||||+---- q (av_quarantined)
1984 |||||||+----- m (av_modified)
1985 ||||||+------ i (immutable)
1986 |||||+------- d (nodump)
1987 ||||+-------- a (appendonly)
1988 |||+--------- S (system)
1989 ||+---------- R (readonly)
1990 |+----------- H (hidden)
1991 +------------ A (archive)
1999 -% atime | crtime | ctime | mtime | all
2011 Equivalent to \fB-u\fR.
2021 Uses the creation time of the file for sorting or printing.
2031 Equivalent to \fB-c\fR.
2041 Uses the last modification time of the file contents for sorting or printing.
2046 If extended system attributes are not supported or if the user does not have
2047 \fBread\fR permission on the file or if the \fBcrtime\fR extended attribute is
2048 not set, \fBcrtime\fR is treated as a synonym for \fBmtime\fR.
2051 When option argument \fBall\fR is specified, all available timestamps are
2052 printed which includes \fBatime\fR, \fBctime\fR, \fBmtime\fR and on the
2053 extended system attribute supporting file systems, \fBcrtime\fR (create time).
2054 The option \fB-% all\fR does not effect which timestamp is displayed in long
2055 format and does not affect sorting.
2059 \fB\fB--block-size\fR \fIsize\fR\fR
2063 Display sizes in multiples of size. Size can be scaled by suffixing one of
2064 \fBYyZzEePpTtGgMmKk\fR. Additionally, a \fBB\fR can be placed at the end to
2065 indicate powers of 10 instead of 2. For example, . \fB10mB\fR means blocks of
2066 \fB10000000\fR bytes while \fB10m\fR means blocks of \fB10*2^20 -- 10485760
2067 --\fR bytes. This is mutually exclusive with the \fB-h\fR option.
2073 \fB\fB--color\fR \fB[=\fR\fIwhen\fR\fB]\fR\fR
2077 \fB\fB--colour\fR\fB[=\fR\fIwhen\fR\fB]\fR\fR
2081 Display filenames using color on color-capable terminals. \fIwhen\fR is an
2082 optional argument that determines when to display color output.
2084 Possible values for \fIwhen\fR are:
2118 Use color if a terminal is present.
2136 Never use color. This is the default
2139 See \fBCOLOR OUTPUT\fR for information on how to control the output colors.
2145 \fB\fB--file-type\fR\fR
2149 Display a suffix after a file depending on it's type, similar to the \fB-F\fR
2150 option, except \fB*\fR is not appended to executable files.
2164 Display human scaled sizes similar to the \fB-h\fR option, except values are
2165 repeatedly divided by 1000 instead of 1024. The last option \fB--si\fR or
2166 \fB-h\fR determines the divisor used.
2172 \fB\fB--time-style\fR style\fR
2176 Display times using the specified style. This does not effect the times
2177 displayed for extended attributes (\fB-%\fR).
2179 Possible values for \fIstyle\fR are:
2183 \fB\fBfull-iso\fR\fR
2187 Equivalent to \fB-E\fR.
2193 \fB\fBlong-iso\fR\fR
2197 Display in \fIYYYY-MM-DD HH:MM\fR for all files.
2207 Display older files using \fIYYYY-MM-DD\fR and newer files with \fIMM-DD
2218 Use the default locale format for old and new files. This is the default.
2228 Use a custom format. Values are the same as described in \fBstrftime\fR(3C). If
2229 a NEWLINE appears in the string, the first line is used for older files and the
2230 second line is used for newer files. Otherwise, the given format is used for
2242 Marks directories with a trailing slash (\fB/\fR), doors with a trailing
2243 greater-than sign (\fB>\fR), executable files with a trailing asterisk
2244 (\fB*\fR), \fBFIFO\fRs with a trailing vertical bar (\fB|\fR), symbolic links
2245 with a trailing "at" sign (\fB@\fR), and \fBAF_UNIX\fR address family sockets
2246 with a trailing equals sign (\fB=\fR). Does not follow symlinks named as
2247 operands unless the \fB-H\fR or \fB-L\fR option is specified.
2253 \fB\fB--file-type\fR\fR
2257 Marks entries as with \fB-F\fR with the exception of executable files.
2258 Executable files are not marked. Does not follow symlinks named as operands
2259 unless the \fB-H\fR or \fB-L\fR option is specified.
2264 Specifying more than one of the options in the following mutually exclusive
2265 pairs is not considered an error: \fB-C\fR and \fB-l\fR (ell), m and
2266 \fB-l\fR(ell), \fB-x\fR and \fB-l\fR (ell), \fB-@\fR and \fB-l\fR (ell),
2267 \fB-C\fR and \fB-1\fR (one), \fB-H\fR and -\fB-L\fR, \fB-c\fR and \fB-u\fR,
2268 \fB-e\fR and \fB-E\fR, \fB-t\fR and \fB-S\fR and \fB-U\fR. The last option
2269 specifying a specific timestamp (\fB-c\fR, \fB-u\fR, \fB-% atime\fR , \fB-%
2270 crtime\fR, \fB-% ctime\fR, and \fB-% mtime\fR) determines the timestamps used
2271 for sorting or in long format listings. The last \fB-t\fR, \fB-S\fR, or
2272 \fB-U\fR option determines the sorting behavior.
2275 The following operand is supported:
2283 A path name of a file to be written. If the file specified is not found, a
2284 diagnostic message is output on standard error.
2289 See \fBlargefile\fR(5) for the description of the behavior of \fBls\fR when
2290 encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
2293 \fBExample 1 \fRViewing File Permissions
2296 The following example shows how to display detailed information about a file.
2302 -rw-r--r-- 1 gozer staff 206663 Mar 14 10:15 file.1
2309 The permissions string above (\fB-rw-r--r--\fR) describes that the file owner
2310 has read and write permissions, the owning group has read permissions, and
2311 others have read permissions.
2315 The following example shows how to display detailed information about a
2322 drwxr-xr-x 2 gozer staff 2 Mar 14 10:17 test.dir
2329 The permissions string above (\fBdrwxr-xr-x\fR) describes that the directory
2330 owner has read, write, and search permissions, the owning group has read and
2331 search permissions, and others have read and search permissions.
2335 Another example of listing file permissions is as follows:
2341 -rw-rwl--- 1 gozer staff 206663 Mar 14 10:47 file.2
2348 The permissions string above (\fB-rw-rwl---\fR) describes that the file owner
2349 has read and write permissions, the owning group has read and write
2350 permissions, and the file can be locked during access.
2353 \fBExample 2 \fRDisplaying ACL Information on Files and Directories
2356 The following example shows how to display verbose ACL information on a ZFS
2363 -rw-r--r-- 1 marks staff 206663 Mar 14 10:15 file.1
2364 0:owner@:execute:deny
2365 1:owner@:read_data/write_data/append_data/write_xattr/write_attributes
2366 /write_acl/write_owner:allow
2367 2:group@:write_data/append_data/execute:deny
2368 3:group@:read_data:allow
2369 4:everyone@:write_data/append_data/write_xattr/execute/write_attributes
2370 /write_acl/write_owner:deny
2371 5:everyone@:read_data/read_xattr/read_attributes/read_acl/synchronize
2379 The following example shows how to display compact ACL information on a ZFS
2386 drwxr-xr-x 2 marks staff 2 Mar 14 10:17 test.dir
2387 owner@:--------------:------:deny
2388 owner@:rwxp---A-W-Co-:------:allow
2389 group@:-w-p----------:------:deny
2390 group@:r-x-----------:------:allow
2391 everyone@:-w-p---A-W-Co-:------:deny
2392 everyone@:r-x---a-R-c--s:------:allow
2399 The following example illustrates the \fBls\fR \fB-v\fR behavior when listing
2400 ACL information on a UFS file.
2406 -rw-r--r-- 1 root root 2703 Mar 14 10:59 file.3
2408 1:group::r-- #effective:r--
2416 \fBExample 3 \fRPrinting the Names of All Files
2419 The following example prints the names of all files in the current directory,
2420 including those that begin with a dot (\fB\&.\fR), which normally do not print:
2425 example% \fBls -a\fR
2431 \fBExample 4 \fRProviding File Information
2434 The following example provides file information:
2446 This command provides information on \fBa\fRll files, including those that
2447 begin with a dot (\fBa\fR), the \fBi\fR-number, the memory address of the
2448 i-node associated with the file\(emprinted in the left-hand column (\fBi\fR);
2449 the \fBs\fRize (in blocks) of the files, printed in the column to the right of
2450 the i-numbers (\fBs\fR); finally, the report is displayed in the \fBn\fRumeric
2451 version of the long list, printing the \fBUID\fR (instead of user name) and
2452 \fBGID\fR (instead of group name) numbers associated with the files.
2456 When the sizes of the files in a directory are listed, a total count of blocks,
2457 including indirect blocks, is printed.
2460 \fBExample 5 \fRProviding Extended System Attributes Information
2464 example% ls -/ c file (extended system attribute in compact mode)
2465 -rw-r--r-- 1 root root 0 May 10 14:17 file
2473 In this example, \fBav_quarantined\fR, \fBoffline\fR, and \fBsparse\fR
2478 example% ls -/ v file (extended system attribute in verbose mode)
2479 -rw-r--r-- 1 root root 0 May 10 14:17 file
2480 {archive,hidden,readonly,system,\e
2481 appendonly,nodump,immutable,av_modified,\e
2482 noav_quarantined,nounlink,nooffline,\e
2485 example% ls -/ v file (no extended system attribute)
2486 -rw-r--r-- 1 root staff 0 May 16 14:48 file
2489 example% ls -/ c file (extended system attribute
2490 supported file system)
2492 -rw-r--r-- 1 root staff 3 Jun 4 22:04 file
2500 \fBarchive\fR and \fBav_modified\fR attributes are set by default on an
2501 extended system attribute supported file.
2505 example% ls -/ c -%crtime file
2507 -rw-r--r-- root root 0 May 10 14:17 file
2515 This example displays the timestamp as the creation time:
2519 example% ls -l -%all file
2520 -rw-r--r-- 1 root root 0 May 10 14:17 file
2521 timestamp: atime Jun 14 08:47:37 2007
2522 timestamp: ctime May 10 14:20:23 2007
2523 timestamp: mtime May 10 14:17:56 2007
2524 timestamp: crtime May 10 14:17:56 2007
2526 example% ls -%crtime -tl file*
2528 -rw-r--r-- 1 foo staff 3 Jun 4 22:04 file1
2529 -rw-r--r-- 1 root root 0 May 10 14:17 file
2530 -rw-r--r-- 1 foo staff 0 May 9 13:49 file.1
2537 In this example the files are sorted by creation time.
2538 .SH ENVIRONMENT VARIABLES
2540 See \fBenviron\fR(5) for descriptions of the following environment variables
2541 that affect the execution of \fBls\fR: \fBLANG\fR, \fBLC_ALL\fR,
2542 \fBLC_COLLATE\fR, \fBLC_CTYPE\fR, \fBLC_TIME\fR, \fBLC_MESSAGES\fR,
2543 \fBNLSPATH\fR, and \fBTZ\fR.
2551 Determines the user's preferred column position width for writing multiple
2552 text-column output. If this variable contains a string representing a decimal
2553 integer, the \fBls\fR utility calculates how many path name text columns to
2554 write (see \fB-C\fR) based on the width provided. If \fBCOLUMNS\fR is not set
2555 or is invalid, 80 is used. The column width chosen to write the names of files
2556 in any given directory is constant. File names are not be truncated to fit into
2557 the multiple text-column output.
2563 \fB\fBLS_COLORS\fR\fR
2567 Determines the coloring scheme used when displaying color output. If not set
2568 and color output is specified, a default scheme is used. If TERM is not set, no
2569 color output is used.
2579 Determine the terminal type. If this variable is unset or NULL, no color output
2580 is generated regardless of the value of the --color option.
2589 All information was written successfully.
2604 \fB\fB/etc/group\fR\fR
2608 group IDs for \fBls\fR \fB-l\fR and \fBls\fR \fB-g\fR
2614 \fB\fB/etc/passwd\fR\fR
2618 user IDs for \fBls\fR \fB-l\fR and \fBls\fR \fB-o\fR
2624 \fB\fB/usr/share/lib/terminfo/?/*\fR\fR
2628 terminal information database
2633 See \fBattributes\fR(5) for descriptions of the following attributes:
2640 ATTRIBUTE TYPE ATTRIBUTE VALUE
2644 Interface Stability Committed
2651 For all options except \fB-A\fR, \fB-b\fR, \fB-e\fR, \fB-E,\fR \fB-h\fR,
2652 \fB-S\fR, U \fB-v\fR, \fB-V\fR, \fB-@\fR, \fB-/\fR, \fB-%\fR, \fB--all\fR,
2653 \fB--almost-all\fR, \fB--block-size\fR, \fB--classify\fR, \fB--color\fR,
2654 \fB--colour\fR, \fB--dereference\fR, \fB--dereference-command-line\fR,
2655 \fB--escape\fR, \fB--file-type\fR, \fB--full-time\fR, \fB--human-readable\fR,
2656 \fB--ignore-backups\fR, \fB--inode\fR, \fB--no-group\fR,
2657 \fB--numeric-uid-gid\fR, \fB--reverse\fR, \fB--recursive\fR, \fB--si\fR,
2658 \fB--size\fR, and \fB--time-style\fR, see \fBstandards\fR(5).
2661 \fBchmod\fR(1), \fBcp\fR(1), \fBsetfacl\fR(1), \fBfgetattr\fR(3C),
2662 \fBstrftime\fR(3C), \fBterminfo\fR(4), \fBacl\fR(5), \fBattributes\fR(5),
2663 \fBenviron\fR(5), \fBfsattr\fR(5), \fBlargefile\fR(5), \fBstandards\fR(5)
2666 Unprintable characters in file names can confuse the columnar output options.
2669 The total block count is incorrect if there are hard links among the files.
2672 The sort order of \fBls\fR output is affected by the locale and can be
2673 overridden by the \fBLC_COLLATE\fR environment variable. For example, if
2674 \fBLC_COLLATE\fR equals \fBC\fR, dot files appear first, followed by names
2675 beginning with upper-case letters, then followed by names beginning with
2676 lower-case letters. But if \fBLC_COLLATE\fR equals \fBen_US.ISO8859-1\fR, then
2677 leading dots as well as case are ignored in determining the sort order.