1 .\" $NetBSD: ls.1,v 1.79 2016/08/10 17:45:12 sevan Exp $
3 .\" Copyright (c) 1980, 1990, 1991, 1993, 1994
4 .\" The Regents of the University of California. All rights reserved.
6 .\" This code is derived from software contributed to Berkeley by
7 .\" the Institute of Electrical and Electronics Engineers, Inc.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
17 .\" 3. Neither the name of the University nor the names of its contributors
18 .\" may be used to endorse or promote products derived from this software
19 .\" without specific prior written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" @(#)ls.1 8.7 (Berkeley) 7/29/94
40 .Nd list directory contents
43 .Op Fl 1AaBbCcdFfghikLlMmnOoPpqRrSsTtuWwXx
48 operand that names a file of a type other than
51 displays its name as well as any requested,
52 associated information.
55 operand that names a file of type directory,
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
73 Force output to be one entry per line.
74 This is the default when output is not to a terminal.
76 List all entries except for
80 Always set for the super-user.
82 Include directory entries whose names begin with a
86 Force printing of non-graphic characters in file names as \exxx, where xxx
87 is the numeric value of the character in octal.
91 but use C escape codes whenever possible.
93 Force multi-column output; this is the default when output is to a terminal.
95 Use time when file status was last changed,
96 instead of time of last modification of the file for printing
103 Directories are listed as plain files (not searched recursively) and
104 symbolic links in the argument list are not followed.
111 immediately after each pathname that is a directory,
114 after each that is executable,
117 after each symbolic link,
129 Output is not sorted.
135 except that the owner is not printed.
141 options, causing the sizes to be reported in bytes displayed in a human
148 For each file, print the file's file serial number (inode number).
152 option, causing the sizes to be reported in kilobytes.
156 For each file, if it's a link, evaluate file information and file type
157 of the referenced file and not the link itself; however still print
158 the link name, unless used with
162 (The lowercase letter
171 options, causing the sizes or block counts reported to be separated with
172 commas (or a locale appropriate separator) resulting in a more readable
179 Stream output format; list files across the page, separated by commas.
184 the owner and group IDs are displayed numerically rather than converting
185 to a owner or group name.
187 Output only leaf files (not directories), eliding other
191 Include the file flags in a long
194 If no file flags are set,
199 for a list of possible flags and their meanings.)
201 Print the full pathname for each file.
205 immediately after each pathname that is a directory.
207 Force printing of non-printable characters in file names as
210 this is the default when output is to a terminal.
212 Recursively list subdirectories encountered.
216 Reverse the order of the sort to get reverse
217 lexicographical order or the smallest or oldest entries first.
219 Sort by size, largest file first.
221 Display the number of file system blocks actually used by each file, in units
226 where partial units are rounded up to the
228 If the output is to a terminal, a total sum for all the file
229 sizes is output on a line before the listing.
233 (the lowercase letter
235 option, display complete time information for the file, including
236 month, day, hour, minute, second, and year.
238 Sort by time modified (most recently modified
239 first) before sorting the operands by lexicographical
242 Use time of last access,
243 instead of last modification
244 of the file for printing
251 Display whiteouts when scanning directories.
253 Force raw printing of non-printable characters.
254 This is the default when output is not to a terminal.
256 Multi-column output sorted across the page rather than down the page.
258 Don't cross mount points when recursing.
267 options all override each other; the last one specified determines
268 the format used for non-printable characters.
278 options all override each other; the last one specified determines
279 the format used with the exception that if both
293 lists one entry per line to standard
294 output; the exceptions are to terminals or when the
298 options are specified.
300 File information is displayed with one or more
302 characters separating the information associated with the
311 option is given, the following information
312 is displayed for each file:
313 .Bl -item -offset indent -compact
327 number of bytes in the file
329 abbreviated month file was last modified
331 day-of-month file was last modified
333 hour and minute file was last modified
338 In addition, for each directory whose contents are displayed, the total
339 number of file system blocks in units of 512 bytes or
343 used by the files in the directory is displayed on a line by itself
344 immediately before the information for the files in the directory.
346 If the owner or group names are not a known owner or group name,
350 the numeric ID's are displayed.
352 If the file is a character special or block special file,
353 the major and minor device numbers for the file are displayed
355 If the file is a symbolic link the pathname of the
356 linked-to file is preceded by
359 The file mode printed under the
361 option consists of the entry type, owner permissions, group
362 permissions, and other permissions.
363 The entry type character describes the type of file, as
366 .Bl -tag -width 4n -offset indent -compact
376 Character special file.
389 The next three fields
390 are three characters each:
392 group permissions, and
394 Each field has three character positions:
395 .Bl -enum -offset indent
399 the file is readable; if
405 the file is writable; if
409 The first of the following that applies:
410 .Bl -tag -width 4n -offset indent
412 If in the owner permissions, the file is not executable and
413 set-user-ID mode is set.
414 If in the group permissions, the file is not executable
415 and set-group-ID mode is set.
417 If in the owner permissions, the file is executable
418 and set-user-ID mode is set.
419 If in the group permissions, the file is executable
420 and setgroup-ID mode is set.
422 The file is executable or the directory is
425 The file is neither readable, writable, executable,
426 nor set-user-ID nor set-group-ID mode, nor sticky.
430 These next two apply only to the third character in the last group
432 .Bl -tag -width 4n -offset indent
434 The sticky bit is set
437 but not execute or search permission.
443 The sticky bit is set (mode
445 and is searchable or executable.
453 The number of bytes displayed for a directory is a function of the
456 structures in the directory, not all of which may be allocated to
459 The following environment variables affect the execution of
461 .Bl -tag -width BLOCKSIZE
463 If the environment variable
467 option is not specified, the block counts
472 will be displayed in units of that size block.
474 If this variable contains a string representing a
475 decimal integer, it is used as the
476 column position width for displaying
477 multiple-text-column output.
480 utility calculates how
481 many pathname text columns to display
482 based on the width provided.
486 The timezone to use when displaying dates.
489 for more information.
494 The group field is now automatically included in the long listing for
495 files in order to be compatible with the
509 utility is expected to be a superset of the