1ls(1)                            User Commands                           ls(1)
2
3
4

NAME

6       ls - list contents of directory
7

SYNOPSIS

9       /usr/bin/ls [-aAbcCdeEfFghHiklLmnopqrRsStuUwvVx1@]
10            [-/ c | v] [-% atime | crtime | ctime | mtime | all]
11            [--block-size size] [--color[=when]] [--file-type]
12            [--si] [--time-style style] [file]...
13
14
15       /usr/xpg4/bin/ls [-aAbcCdeEfFghHiklLmnopqrRsStuUwvVx1@]
16            [-/ c | v] [-% atime | crtime | ctime | mtime | all]
17            [--block-size size] [--color[=when]] [--file-type]
18            [--si] [--time-style style] [file]...
19
20
21       /usr/xpg6/bin/ls [-aAbcCdeEfFghHiklLmnopqrRsStuUwvVx1@]
22            [-/ c | v] [-% atime | crtime | ctime | mtime | all]
23            [--block-size size] [--color[=when]] [--file-type]
24            [--si] [--time-style style] [file]...
25
26

DESCRIPTION

28       For  each file that is a directory, ls lists the contents of the direc‐
29       tory. For each file that is an ordinary file, ls repeats its  name  and
30       any other information requested. The output is sorted alphabetically by
31       default. When no argument  is  given,  the  current  directory  (.)  is
32       listed.  When  several  arguments  are  given,  the arguments are first
33       sorted appropriately, but file arguments appear before directories  and
34       their contents.
35
36
37       There  are  three  major listing formats. The default format for output
38       directed to a terminal is multi−column with  entries  sorted  down  the
39       columns.  The  -1  option  allows  single  column output and -m enables
40       stream output format. In order to determine output formats for the  -C,
41       -x, and -m options, ls uses an environment variable, COLUMNS, to deter‐
42       mine the number of character positions available on one output line. If
43       this variable is not set, the terminfo(4) database is used to determine
44       the number of columns, based on the environment variable, TERM. If this
45       information  cannot  be  obtained,  80  columns  are assumed. If the -w
46       option is used, the argument overrides any other column width.
47
48
49       The mode printed when the -e, -E, -g, -l, -n, -o, -v, -V, or -@  option
50       is  in effect consists of eleven characters. The first character can be
51       one of the following:
52
53       d
54
55           The entry is a directory.
56
57
58       D
59
60           The entry is a door.
61
62
63       l
64
65           The entry is a symbolic link.
66
67
68       b
69
70           The entry is a block special file.
71
72
73       c
74
75           The entry is a character special file.
76
77
78       p
79
80           The entry is a FIFO (or "named pipe") special file.
81
82
83       P
84
85           The entry is an event port.
86
87
88       s
89
90           The entry is an AF_UNIX address family socket.
91
92
93       
94
95           The entry is an ordinary file.
96
97
98
99       The next 9 characters are interpreted as three sets of three bits each.
100       The  first  set  refers to the owner's permissions; the next to permis‐
101       sions of others in the user-group of the file; and the last to all oth‐
102       ers. Within each set, the three characters indicate permission to read,
103       to write, and to execute the file as a  program,  respectively.  For  a
104       directory,  execute  permission  is  interpreted  to mean permission to
105       search the directory for a specified file. The character after  permis‐
106       sions  is an ACL or extended attributes indicator. This character is an
107       @ if extended attributes are associated with the file and the -@ option
108       is in effect. Otherwise, this character is a plus sign (+) character if
109       a non-trivial ACL is associated with the file or a space  character  if
110       not.
111
112
113       If  -/ and/or -% are in effect, then the extended system attributes are
114       printed when filesystem supports extended system attributes.  The  dis‐
115       play looks as follows:
116
117         $ls -/ c  file
118         -rw-r--r--   1 root     root           0 May 10 14:17 file
119                         {AHRSadim-u}
120
121         $ls -/ v file
122         -rw-r--r--   1 root     root           0 May 10 14:17 file
123                         {archive,hidden,readonly,system,appendonly\
124                          nodump,immutable, av_modified,\
125                          noav_quarantined,nounlink}
126
127         $ls -l -% all file
128         -rw-r--r--   1 root     root           0 May 10 14:17 file
129                         timestamp: atime    Jun 25 12:56:44 2007
130                         timestamp: ctime    May 10 14:20:23 2007
131                         timestamp: mtime    May 10 14:17:56 2007
132                         timestamp: crtime   May 10 14:17:56 2007
133
134
135
136
137       See the option descriptions of the -/ and -% option for details.
138
139
140       ls  -l  (the  long  list)  prints  its  output as follows for the POSIX
141       locale:
142
143         -rwxrwxrwx+ 1 smith dev   10876  May 16 9:42 part2
144
145
146
147
148       Reading from right to left, you see that the  current  directory  holds
149       one  file,  named  part2. Next, the last time that file's contents were
150       modified was 9:42 A.M. on May 16. The file contains 10,876  characters,
151       or  bytes. The owner of the file, or the user, belongs to the group dev
152       (perhaps indicating development), and his or her login name  is  smith.
153       The number, in this case 1, indicates the number of links to file part2
154       (see cp(1)). The plus sign indicates that there is  an  ACL  associated
155       with  the  file.  If  the -@ option has been specified, the presence of
156       extended attributes supersede the presence of an ACL and the plus  sign
157       is  replaced  with an 'at' sign (@). Finally, the dash and letters tell
158       you that user, group, and others have permissions to read,  write,  and
159       execute part2.
160
161
162       The execute (x) symbol occupies the third position of the three-charac‐
163       ter sequence. A in the third position would have indicated  a  denial
164       of execution permissions.
165
166
167       The permissions are indicated as follows:
168
169       r
170
171           The file is readable.
172
173
174       w
175
176           The file is writable.
177
178
179       x
180
181           The file is executable.
182
183
184       
185
186           The indicated permission is not granted.
187
188
189       s
190
191           The  set-user-ID  or  set-group-ID bit is on, and the corresponding
192           user or group execution bit is also on.
193
194
195       S
196
197           Undefined bit-state (the set-user-ID or set-group-id bit is on  and
198           the  user  or  group  execution bit is off). For group permissions,
199           this applies only to non-regular files.
200
201
202       t
203
204           The 1000 (octal) bit, or sticky bit, is on (see chmod(1)), and exe‐
205           cution is on.
206
207
208       T
209
210           The  1000  bit  is  turned on, and execution is off (undefined bit-
211           state).
212
213
214   /usr/bin/ls
215       l
216
217           Mandatory locking occurs during access (on a regular file, the set-
218           group-ID bit is on and the group execution bit is off).
219
220
221   /usr/xpg4/bin/ls and /usr/xpg6/bin/ls
222       L
223
224           Mandatory locking occurs during access (on a regular file, the set-
225           group-ID bit is on and the group execution bit is off).
226
227
228
229       For user and group permissions, the third position is  sometimes  occu‐
230       pied  by  a  character  other  than x or -. s or S also can occupy this
231       position, referring to the state of the set-ID bit, whether it  be  the
232       user's  or  the  group's. The ability to assume the same ID as the user
233       during execution is, for example, used during login when you  begin  as
234       root but need to assume the identity of the user you login as.
235
236
237       In  the  case  of  the  sequence of group permissions, l can occupy the
238       third position. l refers to mandatory file  and  record  locking.  This
239       permission  describes a file's ability to allow other files to lock its
240       reading or writing permissions during access.
241
242
243       For others permissions, the third position can be occupied by t  or  T.
244       These refer to the state of the sticky bit and execution permissions.
245
246   Color Output
247       If  color  output  is  enabled,  the  environment variable LS_COLORS is
248       checked.  If it exists, it's contents are used to  control  the  colors
249       used  to display filenames.  If it is not set, a default list of colors
250       is used. The format of LS_COLORS is a colon separated list of attribute
251       specifications. Each attribute specification is of the format
252
253         filespec=attr[;attr..]
254
255
256
257
258       filespec  is either of the form *.SUFFIX, for example, *.jar or *.Z, or
259       one of the following file types:
260
261       no
262
263           Normal file
264
265
266       fi
267
268           Regular file
269
270
271       di
272
273           Directory
274
275
276       ln
277
278           Symbolic link
279
280
281       pi
282
283           FIFO or named pipe
284
285
286       so
287
288           Socket
289
290
291       do
292
293           Door file
294
295
296       bd
297
298           Block device
299
300
301       cd
302
303           Character device
304
305
306       ex
307
308           Execute bit (either user, group, or other) set
309
310
311       po
312
313           Event port
314
315
316       st
317
318           Sticky bit set
319
320
321       or
322
323           Orphaned symlink
324
325
326       sg
327
328           setgid binary
329
330
331       su
332
333           setuid binary
334
335
336       ow
337
338           world writable
339
340
341       tw
342
343           Sticky bit and world writable
344
345
346
347       attr is a semicolon delimited list  of  color  and  display  attributes
348       which are combined to determine the final output color. Any combination
349       of attr values can be specified. Possible attr values are:
350
351       00
352
353           All attributes off (default terminal color)
354
355
356       01
357
358           Display text in bold
359
360
361       04
362
363           Display text with an underscore
364
365
366       05
367
368           Display text in bold
369
370
371       07
372
373           Display text with foreground and background colors reversed
374
375
376       08
377
378           Display using concealed text.
379
380
381
382       One of the following values can be chosen. If multiple values are spec‐
383       ified, the last specified value is used.
384
385       30
386
387           Set foreground to black.
388
389
390       31
391
392           Set foreground to red.
393
394
395       32
396
397           Set foreground to green.
398
399
400       33
401
402           Set foreground to yellow.
403
404
405       34
406
407           Set foreground to blue.
408
409
410       35
411
412           Set foreground to magenta (purple).
413
414           Set foreground to .
415
416
417       36
418
419           Set foreground to cyan.
420
421
422       37
423
424           Set foreground to white.
425
426
427       39
428
429           Set foreground to default terminal color.
430
431
432
433       One  of  the  following can be specified. If multiple values are speci‐
434       fied, the last value specified is used.
435
436       40
437
438           Set foreground to black.
439
440
441       41
442
443           Set foreground to red.
444
445
446       42
447
448           Set foreground to green.
449
450
451       43
452
453           Set foreground to yellow.
454
455
456       44
457
458           Set foreground to blue.
459
460
461       45
462
463           Set foreground to magenta (purple).
464
465
466       46
467
468           Set foreground to cyan.
469
470
471       47
472
473           Set foreground to white.
474
475
476       49
477
478           Set foreground to default terminal color.
479
480
481
482       On some terminals, setting the bold  attribute  causes  the  foreground
483       colors  to be high-intensity, that is, brighter. In such cases the low-
484       intensity yellow is often displayed as a brown or orange color.
485
486
487       At least one attribute must be listed for a file specification.
488
489
490       The appropriate color codes are chosen by selecting the  most  specific
491       match,  starting  with  the  file suffixes and proceeding with the file
492       types until a match is found. The no (normal  file)  type  matches  any
493       file.
494

OPTIONS

496       The following options are supported:
497
498   /usr/bin/ls, /usr/xpg4/bin/ls, and /usr/xpg6/bin/ls
499       The following options are supported for all three versions:
500
501       -a
502       --all
503
504           Lists all entries, including those that begin with a dot (.), which
505           are normally not listed.
506
507
508       -A
509       --almost-all
510
511           Lists all entries, including those that begin with a dot (.),  with
512           the exception of the working directory (.) and the parent directory
513           (..).
514
515
516       -b
517       --escape
518
519           Forces printing of non-printable characters to be in the octal \ddd
520           notation.
521
522
523       -B
524       --ignore-backups
525
526           Do not display any files ending with a tilde (~).
527
528
529       -c
530
531           Uses  time  of  last modification of the i-node (file created, mode
532           changed, and so forth) for sorting (-t) or printing (-l or -n).
533
534
535       -C
536
537           Multi-column output with entries sorted down the columns.  This  is
538           the default output format.
539
540
541       -d
542
543           If  an  argument  is a directory, lists only its name (not its con‐
544           tents). Often used with -l to get the status of a directory.
545
546
547       -e
548
549           The same as -l, except displays time to the second,  and  with  one
550           format for all files regardless of age: mmm dd hh:mm:ss yyyy.
551
552
553       -E
554
555           The same as -l, except displays time to the nanosecond and with one
556           format   for   all   files   regardless    of    age:    yyyy-mm-dd
557           hh:mm:ss.nnnnnnnnn (ISO 8601:2000 format).
558
559           In  addition,  this  option  displays  the  offset  from UTC in ISO
560           8601:2000 standard format (+hhmm or -hhmm) or no characters if  the
561           offset is indeterminable. The offset reflects the appropriate stan‐
562           dard or alternate offset in force at the file's displayed date  and
563           time, under the current timezone.
564
565
566       -f
567
568           Forces  each argument to be interpreted as a directory and list the
569           name found in each slot. This option turns off -l, -t, -s, -S,  and
570           -r, and turns on -a. The order is the order in which entries appear
571           in the directory.
572
573
574       -F
575       --classify
576
577           Append a symbol after certain types of files to indicate  the  file
578           type. The following symbols are used:
579
580           /
581
582               Directory
583
584
585           >
586
587               Door file
588
589
590           |
591
592               Named pipe (FIFO)
593
594
595           @
596
597               Symbolic link
598
599
600           =
601
602               Socket
603
604
605           *
606
607               Executable
608
609
610
611       -g
612
613           The same as -l, except that the owner is not printed.
614
615
616       -h
617       --human-readable
618
619           All  sizes are scaled to a human readable format, for example, 14K,
620           234M, 2.7G, or 3.0T. Scaling is done by  repetitively  dividing  by
621           1024. The last --si or -h option determines the divisor used.
622
623
624       -H
625       --dereference-command-line
626
627           If an argument is a symbolic link that references a directory, this
628           option evaluates the file information and file type of  the  direc‐
629           tory  that  the  link  references,  rather  than  those of the link
630           itself. However, the name of the link is displayed, rather than the
631           referenced directory.
632
633
634       -i
635       --inode
636
637           For  each file, prints the i-node number in the first column of the
638           report.
639
640
641       -k
642
643           All sizes are printed in kbytes. Equivalent to --block-size=1024.
644
645
646       -l
647
648           Lists in long format, giving mode, ACL indication, number of links,
649           owner, group, size in bytes, and time of last modification for each
650           file (see above). If the file is a special  file,  the  size  field
651           instead contains the major and minor device numbers. If the time of
652           last modification is greater than six months ago, it  is  shown  in
653           the format `month date year' for the POSIX locale. When the LC_TIME
654           locale category is not set to the POSIX locale, a different  format
655           of  the  time  field  can be used. Files modified within six months
656           show `month date time'. If the file is a symbolic link,  the  file‐
657           name is printed followed by "" and the path name of the referenced
658           file.
659
660
661       -L
662       --dereference
663
664           If an argument is a symbolic link, this option evaluates  the  file
665           information  and  file  type of the file or directory that the link
666           references, rather than those of the link itself. However, the name
667           of the link is displayed, rather than the referenced file or direc‐
668           tory.
669
670
671       -m
672
673           Streams output format. Files are listed across the page,  separated
674           by commas.
675
676
677       -n
678       --numeric-uid-gid
679
680           The same as -l, except that the owner's UID and group's GID numbers
681           are printed, rather than the associated character strings.
682
683
684       -o
685       --no-group
686
687           The same as -l, except that the group is not printed.
688
689
690       -p
691
692           Puts a slash (/) after each filename if the file is a directory.
693
694
695       -q
696       --hide-control-chars
697
698           Forces printing of non-printable characters in file  names  as  the
699           character question mark (?).
700
701
702       -r
703       --reverse
704
705           Reverses the order of sort to get reverse alphabetic, oldest first,
706           or smallest file size first as appropriate.
707
708
709       -R
710       --recursive
711
712           Recursively lists subdirectories encountered.
713
714
715       -s
716       --size
717
718           Indicate the total number of file system blocks  consumed  by  each
719           file displayed.
720
721
722       -S
723
724           Sort by file size (in decreasing order) and for files with the same
725           size by file name (in increasing alphabetic order) instead of  just
726           by name.
727
728
729       -t
730
731           Sorts  by time stamp (latest first) instead of by name. The default
732           is the last modification time. See -c, -u and -%.
733
734
735       -u
736
737           Uses time of last access instead of last modification  for  sorting
738           (with the -t option) or printing (with the -l option).
739
740
741       -U
742
743           Output is unsorted.
744
745
746       -v
747
748           The same as -l, except that verbose ACL information is displayed as
749           well as the -l output. ACL information is  displayed  even  if  the
750           file or directory doesn't have an ACL.
751
752
753       -V
754
755           The  same  as  -l, except that compact ACL information is displayed
756           after the -l output.
757
758           The -V option is only applicable to file systems that support NFSv4
759           ACLs, such as the Solaris ZFS file system.
760
761           The format of the displayed ACL is as follows:
762
763             entry_type : permissions : inheritance_flags : access_type
764
765
766           entry_type is displayed as one of the following:
767
768           user:username
769
770               Additional user access for username.
771
772
773           group:groupname
774
775               Additional group access for group groupname.
776
777
778           owner@
779
780               File owner.
781
782
783           group@
784
785               File group owner.
786
787
788           everyone@
789
790               Everyone  access,  including  file  owner and file group owner.
791               This is not equivalent to the POSIX other class.
792
793           The following permissions, supported by the NFSv4  ACL  model,  are
794           displayed by using the -v or -V options:
795
796           read_data (r)
797
798               Permission to read the data of a file.
799
800
801           list_directory (r)
802
803               Permission to list the contents of a directory.
804
805
806           write_data (w)
807
808               Permission to modify a file's data. anywhere in the file's off‐
809               set range.
810
811
812           add_file (w)
813
814               Permission to add a new file to a directory.
815
816
817           append_data (p)
818
819               The ability to modify a file's data, but only starting at EOF.
820
821
822           add_subdirectory (p)
823
824               Permission to create a subdirectory to a directory.
825
826
827           read_xattr (R)
828
829               Ability to read the extended attributes of a file.
830
831
832           write_xattr (W)
833
834               Ability to create extended attributes or write to the  extended
835               attribute directory.
836
837
838           execute (x)
839
840               Permission to execute a file.
841
842
843           read_attributes (a)
844
845               The ability to read basic attributes (non-ACLs) of a file.
846
847
848           write_attributes (A)
849
850               Permission to change the times associated with a file or direc‐
851               tory to an arbitrary value.
852
853
854           delete (d)
855
856               Permission to delete a file.
857
858
859           delete_child (D)
860
861               Permission to delete a file within a directory.
862
863
864           read_acl (c)
865
866               Permission to read the ACL of a file.
867
868
869           write_acl (C)
870
871               Permission to write the ACL of a file.
872
873
874           write_owner (o)
875
876               Permission to change the owner of a file.
877
878
879           synchronize (s)
880
881               Permission to access file locally at  server  with  synchronize
882               reads and writes.
883
884
885           -
886
887               No permission granted
888
889           The  following inheritance flags, supported by the NFSv4 ACL model,
890           are displayed by using the -v or -V options:
891
892           file_inherit (f)
893
894               Inherit to all newly created files.
895
896
897           dir_inherit (d)
898
899               Inherit to all newly created directories.
900
901
902           inherit_only (i)
903
904               When placed on a directory, do not apply to the directory, only
905               to newly created files and directories. This flag requires that
906               either file_inherit and or dir_inherit is also specified.
907
908
909           no_propagate (n)
910
911               Indicates that ACL entries should be inherited to objects in  a
912               directory,  but  inheritance  should  stop after descending one
913               level. This flag is dependent upon either file_inherit  and  or
914               dir_inherit also being specified.
915
916
917           successful_access (S)
918
919               Indicates  if an alarm or audit record should be initiated upon
920               successful accesses. Used with audit/alarm ACE types.
921
922
923           failed_access (F)
924
925               Indicates if an alarm or audit record should be initiated  when
926               access fails. Used with audit/alarm ACE types.
927
928
929           inherited (I)
930
931               ACE was inherited.
932
933
934           -
935
936               No permission granted.
937
938           access_type is displayed as one of the following types:
939
940           alarm    Permission  field  that  specifies permissions that should
941                    trigger an alarm.
942
943
944           allow    Permission field that specifies allow permissions.
945
946
947           audit    Permission field that specifies permissions that should be
948                    audited.
949
950
951           deny     Permission field that specifies deny permissions.
952
953           For example:
954
955             $ ls -dV /sandbox/dir.1
956               drwxr-xr-x+  2 root     root           2 Jan 17 15:09 dir.1
957                               user:marks:r-------------:fd-----:allow
958                                   owner@:--------------:-------:deny
959                                   owner@:rwxp---A-W-Co-:-------:allow
960                                   group@:-w-p----------:-------:deny
961                                   group@:r-x-----------:-------:allow
962                                everyone@:-w-p---A-W-Co-:-------:deny
963                                everyone@:r-x---a-R-c--s:-------:allow
964             $
965                                        ||||||||||||||||:||||||+ inherited access
966                                          ||||||||||||||:||||||+ failed access
967                                          ||||||||||||||:|||||+--success access
968                                          ||||||||||||||:||||+-- no propagate
969                                          ||||||||||||||:|||+--- inherit only
970                                          ||||||||||||||:||+---- directory inherit
971                                          ||||||||||||||:|+----- file inherit
972                                          ||||||||||||||
973                                          ||||||||||||||+ sync
974                                          |||||||||||||+- change owner
975                                          ||||||||||||+-- write ACL
976                                          |||||||||||+--- read ACL
977                                          ||||||||||+---- write extended attributes
978                                          |||||||||+----- read extended attributes
979                                          ||||||||+------ write attributes
980                                          |||||||+------- read attributes
981                                          ||||||+-------- delete child
982                                          |||||+--------- delete
983                                          ||||+---------- append
984                                          |||+----------- execute
985                                          ||+------------ write data
986                                          |+------------- read data
987
988
989
990
991       -w cols
992       --width cols
993
994           Multi-column output where the column width is forced to cols.
995
996
997       -x
998
999           Multi-column output with entries sorted across rather than down the
1000           page.
1001
1002
1003       -1
1004
1005           Prints one entry per line of output.
1006
1007
1008       -@
1009
1010           The same as -l, except that extended  attribute  information  over‐
1011           rides  ACL information. An @ is displayed after the file permission
1012           bits for files that have extended attributes.
1013
1014
1015       -c | -v
1016
1017           The same as -l,  and  in  addition  displays  the  extended  system
1018           attributes associated with the file when extended system attributes
1019           are fully supported by the underlying file system.  The  option  -/
1020           supports  two  option  arguments  c  (compact  mode) and v (verbose
1021           mode).
1022
1023           appendonly
1024
1025               Allows a file to be modified only at offset  EOF.  Attempts  to
1026               modify a file at a location other than EOF fails with EPERM.
1027
1028
1029           archive
1030
1031               Indicates  if a file has been modified since it was last backed
1032               up. Whenever the modification time (mtime) of a file is changed
1033               the archive attribute is set.
1034
1035
1036           av_modified
1037
1038               ZFS  sets the anti-virus attribute which whenever a file's con‐
1039               tent or size changes or when the file is renamed.
1040
1041
1042           av_quarantined
1043
1044               Anti-virus software sets to mark a file as quarantined.
1045
1046
1047           crtime
1048
1049               Timestamp when a file is created.
1050
1051
1052           hidden
1053
1054               Marks a file as hidden.
1055
1056
1057           immutable
1058
1059               Prevents the content of a file from being modified.  Also  pre‐
1060               vents  all  metadata  changes,  except for access time updates.
1061               When placed on a directory, prevents the deletion and  creation
1062               of  files in the directories. Attempts to modify the content of
1063               a file or  directory  marked  as  immutable  fail  with  EPERM.
1064               Attempts to modify any attributes (with the exception of access
1065               time and, with the proper privileges, the immutable) of a  file
1066               marked as immutable fails with EPERM.
1067
1068
1069           nodump
1070
1071               Solaris systems have no special semantics for this attribute.
1072
1073
1074           nounlink
1075
1076               Prevents  a  file  from  being  deleted.  On  a  directory, the
1077               attribute also prevents any changes  to  the  contents  of  the
1078               directory.  That  is,  no  files  within  the  directory can be
1079               removed or renamed. The errno EPERM is returned when attempting
1080               to  unlink  or  rename files and directories that are marked as
1081               nounlink.
1082
1083
1084           readonly
1085
1086               Marks a file as readonly. Once a file is marked as readonly the
1087               content data of the file cannot be modified. Other metadata for
1088               the file can still be modified.
1089
1090
1091           system
1092
1093               Solaris systems have no special semantics for this attribute.
1094
1095
1096
1097
1098       The display characters used in compact mode (-/ c) are as follows:
1099
1100         Attribute Name     Display
1101         archive            A
1102         hidden             H
1103         readonly           R
1104         system             S
1105         appendonly         a
1106         nodump             d
1107         immutable          i
1108         av_modified        m
1109         av_quarantined     q
1110         nounlink           u
1111
1112
1113
1114
1115       The display in verbose mode (/ v) uses full attribute names when it  is
1116       set and the name prefixed by 'no' when it is not set.
1117
1118
1119       The  attribute  name crtime and all other timestamps are handled by the
1120       option -% with the respective timestamp option arguments and also  with
1121       all  option argument. The display positions are as follows: The display
1122       in verbose mode (-/ v) uses full attribute names  when it  is  set  and
1123       the  name  prefixed by no when it is not set. The attribute name crtime
1124       and all other timestamps are handled by the option -% with the  respec‐
1125       tive timestamp option arguments and also with all option argument.
1126
1127
1128       The display positions are as follows:
1129
1130         {||||||||||}
1131          |||||||||+- u (nounlink)
1132          ||||||||+-- q (av_quarantined)
1133          |||||||+--- m (av_modified)
1134          ||||||+---- i (immutable)
1135          |||||+----- d (nodump)
1136          ||||+------ a (appendonly)
1137          |||+------- S (system)
1138          ||+-------- R (readonly)
1139          |+--------- H (hidden)
1140          +---------- A (archive)
1141
1142
1143
1144         -% atime | crtime | ctime | mtime | all
1145
1146
1147
1148       atime
1149
1150           Equivalent to -u.
1151
1152
1153       crtime
1154
1155           Uses the creation time of the file for sorting or printing.
1156
1157
1158       ctime
1159
1160           Equivalent to -c.
1161
1162
1163       mtime
1164
1165           Uses the last modification time of the file contents for sorting or
1166           printing.
1167
1168
1169
1170       If extended system attributes are not supported or if the user does not
1171       have read permission on the file or if the crtime extended attribute is
1172       not set, crtime is treated as a synonym for mtime.
1173
1174
1175       When option argument -all is specified, all  available  timestamps  are
1176       printed  which includes -atime, -ctime, -mtime and on the extended sys‐
1177       tem attribute supporting  file  systems,  -crtime  (create  time).  The
1178       option -% all does not effect which timestamp is displayed in long for‐
1179       mat and does not affect sorting.
1180
1181       --block-size size
1182
1183           Display sizes in multiples of size. Size can be scaled by suffixing
1184           one of YyZzEePpTtGgMmKk. Additionally, a B can be placed at the end
1185           to indicate powers of 10 instead of 2. For example,  .  10mB  means
1186           blocks  of  10000000  bytes  while  10m  means blocks of 10*2^20 --
1187           10485760 -- bytes. This is mutually exclusive with the -h option.
1188
1189
1190       --color [=when]
1191       --colour[=when]
1192
1193           Display filenames using color on color-capable terminals.  when  is
1194           an optional argument that determines when to display color output.
1195
1196           Possible values for when are:
1197
1198           always
1199           yes
1200           force
1201
1202               Always use color.
1203
1204
1205           auto
1206           tty
1207           if-tty
1208
1209               Use color if a terminal is present.
1210
1211
1212           no
1213           never
1214           none
1215
1216               Never use color. This is the default
1217
1218           See  COLOR OUTPUT for information on how to control the output col‐
1219           ors.
1220
1221
1222       --file-type
1223
1224           Display a suffix after a file depending on it's  type,  similar  to
1225           the -F option, except * is not appended to executable files.
1226
1227
1228       -si
1229       --
1230
1231           Display  human scaled sizes similar to the -h option, except values
1232           are repeatedly divided by 1000 instead of  1024.  The  last  option
1233           --si or -h determines the divisor used.
1234
1235
1236       --time-style style
1237
1238           Display  times  using the specified style. This does not effect the
1239           times displayed for extended attributes (-%).
1240
1241           Possible values for style are:
1242
1243           full-iso
1244
1245               Equivalent to -E.
1246
1247
1248           long-iso
1249
1250               Display in YYYY-MM-DD HH:MM for all files.
1251
1252
1253           iso
1254
1255               Display older files using YYYY-MM-DD and newer files with MM-DD
1256               HH:MM.
1257
1258
1259           locale
1260
1261               Use  the  default  locale format for old and new files. This is
1262               the default.
1263
1264
1265           +FORMAT
1266
1267               Use a custom format. Values are the same as described in  strf‐
1268               time(3C). If a NEWLINE appears in the string, the first line is
1269               used for older files and the second  line  is  used  for  newer
1270               files. Otherwise, the given format is used for all files.
1271
1272
1273
1274   /usr/bin/ls
1275       -F
1276
1277           Marks  directories with a trailing slash (/), doors with a trailing
1278           greater-than sign (>), executable files with  a  trailing  asterisk
1279           (*),  FIFOs with a trailing vertical bar (|), symbolic links with a
1280           trailing "at" sign (@), and AF_UNIX address family sockets  with  a
1281           trailing equals sign (=). Follows symlinks named as operands.
1282
1283
1284       --file-type
1285
1286           Marks  entries  as  with -F with the exception of executable files.
1287           Executable files are not marked. Follows symlinks  named  as  oper‐
1288           ands.
1289
1290
1291
1292       Specifying  more  than  one  of  the  options in the following mutually
1293       exclusive pairs is not considered an error: -C and -l (ell), -m and  -l
1294       (ell),  -x  and  -l (ell), -@ and -l (ell). The -l option overrides the
1295       other option specified in each pair.
1296
1297
1298       Specifying more than one of  the  options  in  the  following  mutually
1299       exclusive  groups  is  not considered an error: -C and -1 (one), -H and
1300       -L, -c and -u, and -e and -E, and -t and -S. The last option specifying
1301       a  specific  timestamp  (-c, -u, -% atime , -% crtime, -% ctime, and -%
1302       mtime) determines the timestamps used for sorting  or  in  long  format
1303       listings.  The  last option -t, -S, or -U determines the sorting behav‐
1304       ior.
1305
1306   /usr/xpg4/bin/ls
1307       -F
1308
1309           Marks directories with a trailing slash (/), doors with a  trailing
1310           greater-than  sign  (>),  executable files with a trailing asterisk
1311           (*), FIFOs with a trailing vertical bar (|), symbolic links with  a
1312           trailing  "at"  sign (@), and AF_UNIX address family sockets with a
1313           trailing equals sign (=). Follows symlinks named as operands.
1314
1315
1316       --file-type
1317
1318           Marks entries as with -F with the exception  of  executable  files.
1319           Executable  files  are  not marked. Follows symlinks named as oper‐
1320           ands.
1321
1322
1323
1324       Specifying more than one of the options  in  the  following  groups  of
1325       mutually exclusive options is not considered an error: -C and -l (ell),
1326       -m and -l (ell), -x and -l (ell), -@ and -l (ell), -C and -1 (one),  -H
1327       and  -L, -c and -u, -e and -E, -t and -S and -U. The last option speci‐
1328       fying a specific timestamp (-c, -u, -% atime , -% crtime, -% ctime, and
1329       -%  mtime) determines the timestamps used for sorting or in long format
1330       listings. The last -t, -S, or -U option determines the  sorting  behav‐
1331       ior.
1332
1333   /usr/xpg6/bin/ls
1334       -F
1335
1336           Marks  directories with a trailing slash (/), doors with a trailing
1337           greater-than sign (>), executable files with  a  trailing  asterisk
1338           (*),  FIFOs with a trailing vertical bar (|), symbolic links with a
1339           trailing "at" sign (@), and AF_UNIX address family sockets  with  a
1340           trailing  equals  sign (=). Does not follow symlinks named as oper‐
1341           ands unless the -H or -L option is specified.
1342
1343
1344       --file-type
1345
1346           Marks entries as with -F with the exception  of  executable  files.
1347           Executable  files are not marked. Does not follow symlinks named as
1348           operands unless the -H or -L option is specified.
1349
1350
1351
1352       Specifying more than one of  the  options  in  the  following  mutually
1353       exclusive  pairs  is  not  considered  an error: -C and -l (ell), m and
1354       -l(ell), -x and -l (ell), -@ and -l (ell), -C and -1 (one), -H and --L,
1355       -c  and  -u,  -e and -E, -t and -S and -U. The last option specifying a
1356       specific timestamp (-c, -u, -% atime , -%  crtime,  -%  ctime,  and  -%
1357       mtime)  determines  the  timestamps  used for sorting or in long format
1358       listings. The last -t, -S, or -U option determines the  sorting  behav‐
1359       ior.
1360

OPERANDS

1362       The following operand is supported:
1363
1364       file
1365
1366           A  path  name of a file to be written. If the file specified is not
1367           found, a diagnostic message is output on standard error.
1368
1369

USAGE

1371       See largefile(5) for the description of the behavior of ls when encoun‐
1372       tering files greater than or equal to 2 Gbyte ( 2^31 bytes).
1373

EXAMPLES

1375       Example 1 Viewing File Permissions
1376
1377
1378       The following example shows how to display detailed information about a
1379       file.
1380
1381
1382         % ls -l file.1
1383         -rw-r--r--   1 gozer    staff     206663 Mar 14 10:15 file.1
1384
1385
1386
1387
1388       The permissions string above (-rw-r--r--) describes that the file owner
1389       has  read and write permissions, the owning group has read permissions,
1390       and others have read permissions.
1391
1392
1393
1394       The following example shows how to display detailed information about a
1395       directory.
1396
1397
1398         % ls -ld test.dir
1399         drwxr-xr-x   2 gozer    staff          2 Mar 14 10:17 test.dir
1400
1401
1402
1403
1404       The  permissions string above (drwxr-xr-x) describes that the directory
1405       owner has read, write, and search permissions,  the  owning  group  has
1406       read  and  search  permissions, and others have read and search permis‐
1407       sions.
1408
1409
1410
1411       Another example of listing file permissions is as follows:
1412
1413
1414         % ls -l file.2
1415         -rw-rwl---   1 gozer    staff     206663 Mar 14 10:47 file.2
1416
1417
1418
1419
1420       The permissions string above (-rw-rwl---) describes that the file owner
1421       has  read  and  write  permissions, the owning group has read and write
1422       permissions, and the file can be locked during access.
1423
1424
1425       Example 2 Displaying ACL Information on Files and Directories
1426
1427
1428       The following example shows how to display verbose ACL information on a
1429       ZFS file.
1430
1431
1432         % ls -v file.1
1433         -rw-r--r--   1 marks    staff     206663 Mar 14 10:15 file.1
1434              0:owner@:execute:deny
1435              1:owner@:read_data/write_data/append_data/write_xattr/write_attributes
1436                   /write_acl/write_owner:allow
1437              2:group@:write_data/append_data/execute:deny
1438              3:group@:read_data:allow
1439              4:everyone@:write_data/append_data/write_xattr/execute/write_attributes
1440                   /write_acl/write_owner:deny
1441              5:everyone@:read_data/read_xattr/read_attributes/read_acl/synchronize
1442                   :allow
1443
1444
1445
1446
1447       The following example shows how to display compact ACL information on a
1448       ZFS  directory.
1449
1450
1451         % ls -dV test.dir
1452         drwxr-xr-x   2 marks    staff          2 Mar 14 10:17 test.dir
1453                     owner@:--------------:------:deny
1454                     owner@:rwxp---A-W-Co-:------:allow
1455                     group@:-w-p----------:------:deny
1456                     group@:r-x-----------:------:allow
1457                     everyone@:-w-p---A-W-Co-:------:deny
1458                     everyone@:r-x---a-R-c--s:------:allow
1459
1460
1461
1462
1463       The following example illustrates the ls -v behavior when  listing  ACL
1464       information on a UFS file.
1465
1466
1467         $ ls -v file.3
1468         -rw-r--r--   1 root     root        2703 Mar 14 10:59 file.3
1469              0:user::rw-
1470              1:group::r--               #effective:r--
1471              2:mask:r--
1472              3:other:r--
1473
1474
1475
1476       Example 3 Printing the Names of All Files
1477
1478
1479       The  following  example  prints  the  names of all files in the current
1480       directory, including those that begin with a dot (.), which normally do
1481       not print:
1482
1483
1484         example% ls -a
1485
1486
1487
1488       Example 4 Providing File Information
1489
1490
1491       The following example provides file information:
1492
1493
1494         example% ls -aisn
1495
1496
1497
1498
1499       This  command  provides  information on all files, including those that
1500       begin with a dot (a), the i-number, the memory address  of  the  i-node
1501       associated  with the file—printed in the left-hand column (i); the size
1502       (in blocks) of the files, printed in the column to the right of the  i-
1503       numbers (s); finally, the report is displayed in the numeric version of
1504       the long list, printing the UID (instead of user name) and GID (instead
1505       of group name) numbers associated with the files.
1506
1507
1508
1509       When the sizes of the files in a directory are listed, a total count of
1510       blocks, including indirect blocks, is printed.
1511
1512
1513       Example 5 Providing Extended System Attributes Information
1514
1515         example% ls -/ c file    (extended system attribute in compact mode)
1516         -rw-r--r--   1 root     root           0 May 10 14:17 file
1517                                  {AHRSadim-u}
1518
1519
1520
1521
1522       In this example, av_quarantined is not set.
1523
1524         example% ls -/ v file (extended system attribute in verbose mode)
1525         -rw-r--r--   1 root     root           0 May 10 14:17 file
1526                         {archive,hidden,readonly,system,appendonly\
1527                          nodump,immutable,av_modified,\
1528                          noav_quarantined,nounlink}
1529
1530         example% ls -/ v file     (no extended system attribute)
1531         -rw-r--r--  1 root    staff        0 May 16 14:48 file
1532                        {}
1533
1534         example% ls -/ c file        (extended system attribute
1535                                       supported file system)
1536
1537         -rw-r--r--  1 root staff        3 Jun  4 22:04 file
1538                        {A------m--}
1539
1540
1541
1542
1543       archive and av_modified attributes are set by default on   an  extended
1544       system attribute supported file.
1545
1546         example% ls -/ c  -%crtime file
1547
1548         -rw-r--r--    root     root          0 May 10 14:17 file
1549                        {AHRSadim-u}
1550
1551
1552
1553
1554       This example displays the timestamp as the creation time:
1555
1556         example% ls -l -%all file
1557         -rw-r--r--   1 root     root           0 May 10 14:17    file
1558                         timestamp: atime    Jun 14 08:47:37 2007
1559                         timestamp: ctime    May 10 14:20:23 2007
1560                         timestamp: mtime    May 10 14:17:56 2007
1561                         timestamp: crtime   May 10 14:17:56 2007
1562
1563         example% ls -%crtime -tl file*
1564
1565         -rw-r--r--   1 foo      staff          3 Jun  4 22:04 file1
1566         -rw-r--r--   1 root     root           0 May 10 14:17 file
1567         -rw-r--r--   1 foo      staff          0 May  9 13:49 file.1
1568
1569
1570
1571
1572       In this example the files are sorted by creation time.
1573

ENVIRONMENT VARIABLES

1575       See  environ(5) for descriptions of the following environment variables
1576       that affect the execution of ls: LANG,  LC_ALL,  LC_COLLATE,  LC_CTYPE,
1577       LC_TIME, LC_MESSAGES, NLSPATH, and TZ.
1578
1579       COLUMNS
1580
1581           Determines  the  user's preferred column position width for writing
1582           multiple text-column output. If this  variable  contains  a  string
1583           representing  a decimal integer, the ls utility calculates how many
1584           path name text columns to write (see -C) based on  the  width  pro‐
1585           vided.  If COLUMNS is not set or is invalid, 80 is used. The column
1586           width chosen to write the names of files in any given directory  is
1587           constant.  File names are not be truncated to fit into the multiple
1588           text-column output.
1589
1590
1591       LS_COLORS
1592
1593           Determines the coloring scheme used when displaying  color  output.
1594           If not set and color output is specified, a default scheme is used.
1595           If TERM is not set, no color output is used.
1596
1597
1598       TERM
1599
1600           Determine the terminal type. If this variable is unset or NULL,  no
1601           color  output  is  generated regardless of the value of the --color
1602           option.
1603
1604

EXIT STATUS

1606       0     All information was written successfully.
1607
1608
1609       >0    An error occurred.
1610
1611

FILES

1613       /etc/group
1614
1615           group IDs for ls -l and ls -g
1616
1617
1618       /etc/passwd
1619
1620           user IDs for ls -l and ls -o
1621
1622
1623       /usr/share/lib/terminfo/?/*
1624
1625           terminal information database
1626
1627

ATTRIBUTES

1629       See attributes(5) for descriptions of the following attributes:
1630
1631   /usr/bin/ls
1632       ┌─────────────────────────────┬─────────────────────────────┐
1633       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
1634       ├─────────────────────────────┼─────────────────────────────┤
1635       │Availability                 │SUNWcsu                      │
1636       ├─────────────────────────────┼─────────────────────────────┤
1637       │CSI                          │Enabled                      │
1638       ├─────────────────────────────┼─────────────────────────────┤
1639       │Interface Stability          │Committed                    │
1640       ├─────────────────────────────┼─────────────────────────────┤
1641       │Standard                     │See below.                   │
1642       └─────────────────────────────┴─────────────────────────────┘
1643
1644
1645       For all options except -A, -b, -e, -E, -h, -S, U -v, -V,  -@,  -/,  -%,
1646       --all,   --almost-all,  --block-size,  --classify,  --color,  --colour,
1647       --dereference,   --dereference-command-line,   --escape,   --file-type,
1648       --full-time,  --human-readable,  --ignore-backups, --inode, --no-group,
1649       --numeric-uid-gid, --reverse, --recursive, --si,  --size,  and  --time-
1650       style, see standards(5).
1651
1652   /usr/xpg4/bin/ls
1653       ┌─────────────────────────────┬─────────────────────────────┐
1654       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
1655       ├─────────────────────────────┼─────────────────────────────┤
1656       │Availability                 │SUNWxcu4                     │
1657       ├─────────────────────────────┼─────────────────────────────┤
1658       │CSI                          │Enabled                      │
1659       ├─────────────────────────────┼─────────────────────────────┤
1660       │Interface Stability          │Committed                    │
1661       ├─────────────────────────────┼─────────────────────────────┤
1662       │Standard                     │See below.                   │
1663       └─────────────────────────────┴─────────────────────────────┘
1664
1665
1666       For  all  options  except -A, -b, -e, -E, -h, -S, U -v, -V, -@, -/, -%,
1667       --all,  --almost-all,  --block-size,  --classify,  --color,   --colour,
1668       --dereference,   --dereference-command-line,   --escape,   --file-type,
1669       --full-time, --human-readable, --ignore-backups,  --inode,  --no-group,
1670       --numeric-uid-gid,  --reverse,  --recursive,  --si, --size, and --time-
1671       style, see standards(5).
1672
1673   /usr/xpg6/bin/ls
1674       ┌─────────────────────────────┬─────────────────────────────┐
1675       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
1676       ├─────────────────────────────┼─────────────────────────────┤
1677       │Availability                 │SUNWxcu6                     │
1678       ├─────────────────────────────┼─────────────────────────────┤
1679       │CSI                          │Enabled                      │
1680       ├─────────────────────────────┼─────────────────────────────┤
1681       │Interface Stability          │Committed                    │
1682       ├─────────────────────────────┼─────────────────────────────┤
1683       │Standard                     │See below.                   │
1684       └─────────────────────────────┴─────────────────────────────┘
1685
1686
1687       For all options except -A, -b, -e, -E, -h, -S, U -v, -V,  -@,  -/,  -%,
1688       --all,   --almost-all,  --block-size,  --classify,  --color,  --colour,
1689       --dereference,   --dereference-command-line,   --escape,   --file-type,
1690       --full-time,  --human-readable,  --ignore-backups, --inode, --no-group,
1691       --numeric-uid-gid, --reverse, --recursive, --si,  --size,  and  --time-
1692       style, see standards(5).
1693

SEE ALSO

1695       chmod(1),  cp(1),  setfacl(1), fgetattr(3C), strftime(3C), terminfo(4),
1696       acl(5),  attributes(5),  environ(5),  fsattr(5),  largefile(5),   stan‐
1697       dards(5)
1698

NOTES

1700       Unprintable  characters  in  file names can confuse the columnar output
1701       options.
1702
1703
1704       The total block count is incorrect if there are hard  links  among  the
1705       files.
1706
1707
1708       The  sort order of ls output is affected by the locale and can be over‐
1709       ridden by the LC_COLLATE environment variable. For example, if  LC_COL‐
1710       LATE equals C, dot files appear first, followed by names beginning with
1711       upper-case letters, then followed by names  beginning  with  lower-case
1712       letters. But if LC_COLLATE equals en_US.ISO8859-1, then leading dots as
1713       well as case are ignored in determining the sort order.
1714
1715
1716
1717SunOS 5.11                        3 Jun 2009                             ls(1)
Impressum