2 .\" Copyright (c) 1980, 1990, 1991, 1993, 1994
3 .\" The Regents of the University of California. All rights reserved.
5 .\" This code is derived from software contributed to Berkeley by
6 .\" the Institute of Electrical and Electronics Engineers, Inc.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in the
15 .\" documentation and/or other materials provided with the distribution.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)ls.1 8.7 (Berkeley) 7/29/94
40 .Nd list directory contents
43 .Op Fl ABCFGHILPRSTWZabcdfghiklmnopqrstuwx1
46 For each operand that names a
51 displays its name as well as any requested,
52 associated information.
53 For each operand that names a
57 displays the names of files contained
58 within that directory, as well as any requested, associated
61 If no operands are given, the contents of the current
62 directory are displayed.
63 If more than one operand is given,
64 non-directory operands are displayed first; directory
65 and non-directory operands are sorted separately and in
66 lexicographical order.
68 The following options are available:
69 .Bl -tag -width indent
71 List all entries except for
75 Always set for the super-user.
79 Force printing of non-printable characters (as defined by
81 and current locale settings) in file names as
85 is the numeric value of the character in octal.
87 Force multi-column output; this is the default when output is to a terminal.
91 immediately after each pathname that is a directory,
94 after each that is executable,
97 after each symbolic link,
109 Enable colorized output.
110 This option is equivalent to defining
115 Symbolic links on the command line are followed.
116 This option is assumed if
121 options are specified.
123 This option cancels the
125 option. Usually used by super-user when
129 If argument is a symbolic link, list the file or directory the link references
130 rather than the link itself.
131 This option cancels the
135 If argument is a symbolic link, list the link itself rather than the
136 object the link references.
137 This option cancels the
143 Recursively list subdirectories encountered.
145 Sort by size (largest file first) before sorting the operands in
146 lexicographical order.
152 option, display complete time information for the file, including
153 month, day, hour, minute, second, and year.
155 Display whiteouts when scanning directories.
157 Display each file's MAC label; see
160 Include directory entries whose names begin with a
168 escape codes whenever possible.
170 Use time when file status was last changed for sorting or printing.
172 Directories are listed as plain files (not searched recursively).
174 Output is not sorted.
176 This option is deprecated and is only available for compatibility
179 it was used to display the group name in the long
185 option, use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte
186 and Petabyte in order to reduce the number of digits to four or fewer
187 using base 2 for sizes.
189 For each file, print the file's file serial number (inode number).
191 This has the same effect as setting environment variable
193 to 1024, except that it also nullifies any
197 (The lowercase letter
199 List files in the long format, as described in the
203 Stream output format; list files across the page, separated by commas.
205 Display user and group IDs numerically rather than converting to a user
206 or group name in a long
210 Include the file flags in a long
216 after each filename if that file is a directory.
218 Force printing of non-graphic characters in file names as
221 this is the default when output is to a terminal.
223 Reverse the order of the sort.
225 Display the number of blocks used in the file system by each file.
226 Block sizes and directory totals are handled as described in
228 subsection below, except (if the long format is not also requested)
229 the directory totals are not output when the output is in a
230 single column, even if multi-column output is requested.
232 Sort by time modified (most recently modified
233 first) before sorting the operands in lexicographical
236 Use time of last access,
237 instead of last modification
238 of the file for sorting
243 Force raw printing of non-printable characters.
245 when output is not to a terminal.
249 except that the multi-column output is produced with entries sorted
250 across, rather than down, the columns.
256 This is the default when
257 output is not to a terminal.
264 options all override each other; the last one specified determines
271 options override each other; the last one specified determines
278 options all override each other; the last one specified determines
279 the format used for non-printable characters.
285 options all override each other (either partially or fully); they
286 are applied in the order specified.
290 lists one entry per line to standard
291 output; the exceptions are to terminals or when the
295 options are specified.
297 File information is displayed with one or more
299 separating the information associated with the
307 option is given, the following information
308 is displayed for each file:
310 number of links, owner name, group name,
312 number of bytes in the file, abbreviated
313 month, day-of-month file was last modified,
314 hour file last modified, minute file last
315 modified, and the pathname.
317 If the modification time of the file is more than 6 months
318 in the past or future, then the year of the last modification
319 is displayed in place of the hour and minute fields.
321 If the owner or group names are not a known user or group name,
325 the numeric ID's are displayed.
327 If the file is a character special or block special file,
328 the major and minor device numbers for the file are displayed
330 If the file is a symbolic link the pathname of the
331 linked-to file is preceded by
334 The listing of a directory's contents is preceded
335 by a labeled total number of blocks used in the file system by the files
336 which are listed as the directory's contents
337 (which may or may not include
341 and other files which start with a dot, depending on other options).
343 The default block size is 512 bytes.
344 The block size may be set with option
346 or environment variable
348 Numbers of blocks in the output will have been rounded up so the
349 numbers of bytes is at least as many as used by the corresponding
350 file system blocks (which might have a different size).
352 The file mode printed under the
354 option consists of the
355 entry type and the permissions.
356 The entry type character describes the type of file, as
359 .Bl -tag -width 4n -offset indent -compact
363 Character special file.
376 The next three fields
377 are three characters each:
379 group permissions, and
381 Each field has three character positions:
382 .Bl -enum -offset indent
386 the file is readable; if
392 the file is writable; if
396 The first of the following that applies:
397 .Bl -tag -width 4n -offset indent
399 If in the owner permissions, the file is not executable and
400 set-user-ID mode is set.
401 If in the group permissions, the file is not executable
402 and set-group-ID mode is set.
404 If in the owner permissions, the file is executable
405 and set-user-ID mode is set.
406 If in the group permissions, the file is executable
407 and setgroup-ID mode is set.
409 The file is executable or the directory is
412 The file is neither readable, writable, executable,
413 nor set-user-ID nor set-group-ID mode, nor sticky.
417 These next two apply only to the third character in the last group
419 .Bl -tag -width 4n -offset indent
421 The sticky bit is set
424 but not execute or search permission.
430 The sticky bit is set (mode
432 and is searchable or executable.
440 The next field contains a
443 character if the file has an ACL, or a
449 utility does not show the actual ACL;
454 The following environment variables affect the execution of
456 .Bl -tag -width ".Ev CLICOLOR_FORCE"
458 If this is set, its value, rounded up to 512 or down to a
459 multiple of 512, will be used as the block size in bytes by the
466 subsection for more information.
470 color sequences to distinguish file types.
474 In addition to the file types mentioned in the
476 option some extra attributes (setuid bit set, etc.) are also displayed.
477 The colorization is dependent on a terminal type with the proper
482 console has the proper capabilities,
483 but to display the colors in an
488 variable must be set to
490 Other terminal types may require similar adjustments.
492 is silently disabled if the output is not directed to a terminal
496 .It Ev CLICOLOR_FORCE
497 Color sequences are normally disabled if the output is not directed to
499 This can be overridden by setting this flag.
502 variable still needs to reference a color capable terminal however
503 otherwise it is not possible to determine which color sequences to
506 If this variable contains a string representing a
507 decimal integer, it is used as the
508 column position width for displaying
509 multiple-text-column output.
512 utility calculates how
513 many pathname text columns to display
514 based on the width provided.
520 The locale to use when determining the order of day and month in the long
525 for more information.
527 The value of this variable describes what color to use for which
528 attribute when colors are enabled with
530 This string is a concatenation of pairs of the format
534 is the foreground color and
536 is the background color.
538 The color designators are as follows:
540 .Bl -tag -width 4n -offset indent -compact
558 bold black, usually shows up as dark grey
564 bold brown, usually shows up as yellow
572 bold light grey; looks like bright white
574 default foreground or background
577 Note that the above are standard
580 The actual display may differ
581 depending on the color capabilities of the terminal in use.
583 The order of the attributes are as follows:
585 .Bl -enum -offset indent -compact
601 executable with setuid bit set
603 executable with setgid bit set
605 directory writable to others, with sticky bit
607 directory writable to others, without sticky bit
611 .Qq "exfxcxdxbxegedabagacad" ,
612 i.e., blue foreground and
613 default background for regular directories, black foreground and red
614 background for setuid executables, etc.
616 If this variable is set, it is considered to be a
617 colon-delimited list of minimum column widths.
619 and insufficient widths are ignored (thus zero signifies
620 a dynamically sized column).
621 Not all columns have changeable widths.
623 in order: inode, block count, number of links, user name,
624 group name, flags, file size, file name.
628 functionality depends on a terminal type with color capabilities.
630 The timezone to use when displaying dates.
633 for more information.
638 The group field is now automatically included in the long listing for
639 files in order to be compatible with the
654 With the exception of options
664 The ACL support is compatible with
667 .Pq Dq Tn POSIX Ns .2c
676 To maintain backward compatibility, the relationships between the many
677 options are quite complex.
679 The exception mentioned in the
681 option description might be a feature that was
682 based on the fact that single-column output
683 usually goes to something other than a terminal.
684 It is debatable whether this is a design bug.