1 .\" $NetBSD: ls.1,v 1.72 2012/11/20 12:37:29 abs 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 1AaBbCcdFfghikLlMmnopqRrSsTtuWwx
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.
133 except that the owner is not printed.
139 options, causing the sizes to be reported in bytes displayed in a human
146 For each file, print the file's file serial number (inode number).
150 option, causing the sizes to be reported in kilobytes.
154 For each file, if it's a link, evaluate file information and file type
155 of the referenced file and not the link itself; however still print
156 the link name, unless used with
160 (The lowercase letter
164 A total sum for all the file sizes is output on a line before the long
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 Include the file flags in a long
190 If no file flags are set,
195 for a list of possible flags and their meanings.)
199 immediately after each pathname that is a directory.
201 Force printing of non-printable characters in file names as
204 this is the default when output is to a terminal.
206 Recursively list subdirectories encountered.
210 Reverse the order of the sort to get reverse
211 lexicographical order or the smallest or oldest entries first.
213 Sort by size, largest file first.
215 Display the number of file system blocks actually used by each file, in units
220 where partial units are rounded up to the
222 If the output is to a terminal, a total sum for all the file
223 sizes is output on a line before the listing.
227 (the lowercase letter
229 option, display complete time information for the file, including
230 month, day, hour, minute, second, and year.
232 Sort by time modified (most recently modified
233 first) before sorting the operands by lexicographical
236 Use time of last access,
237 instead of last modification
238 of the file for printing
245 Display whiteouts when scanning directories.
247 Force raw printing of non-printable characters.
248 This is the default when output is not to a terminal.
250 Multi-column output sorted across the page rather than down the page.
259 options all override each other; the last one specified determines
260 the format used for non-printable characters.
270 options all override each other; the last one specified determines
271 the format used with the exception that if both
285 lists one entry per line to standard
286 output; the exceptions are to terminals or when the
290 options are specified.
292 File information is displayed with one or more
294 characters separating the information associated with the
303 option is given, the following information
304 is displayed for each file:
305 .Bl -item -offset indent -compact
319 number of bytes in the file
321 abbreviated month file was last modified
323 day-of-month file was last modified
325 hour and minute file was last modified
330 In addition, for each directory whose contents are displayed, the total
331 number of file system blocks in units of 512 bytes or
335 used by the files in the directory is displayed on a line by itself
336 immediately before the information for the files in the directory.
338 If the owner or group names are not a known owner or group name,
342 the numeric ID's are displayed.
344 If the file is a character special or block special file,
345 the major and minor device numbers for the file are displayed
347 If the file is a symbolic link the pathname of the
348 linked-to file is preceded by
351 The file mode printed under the
353 option consists of the entry type, owner permissions, group
354 permissions, and other permissions.
355 The entry type character describes the type of file, as
358 .Bl -tag -width 4n -offset indent -compact
368 Character special file.
381 The next three fields
382 are three characters each:
384 group permissions, and
386 Each field has three character positions:
387 .Bl -enum -offset indent
391 the file is readable; if
397 the file is writable; if
401 The first of the following that applies:
402 .Bl -tag -width 4n -offset indent
404 If in the owner permissions, the file is not executable and
405 set-user-ID mode is set.
406 If in the group permissions, the file is not executable
407 and set-group-ID mode is set.
409 If in the owner permissions, the file is executable
410 and set-user-ID mode is set.
411 If in the group permissions, the file is executable
412 and setgroup-ID mode is set.
414 The file is executable or the directory is
417 The file is neither readable, writable, executable,
418 nor set-user-ID nor set-group-ID mode, nor sticky.
422 These next two apply only to the third character in the last group
424 .Bl -tag -width 4n -offset indent
426 The sticky bit is set
429 but not execute or search permission.
435 The sticky bit is set (mode
437 and is searchable or executable.
445 The number of bytes displayed for a directory is a function of the
448 structures in the directory, not all of which may be allocated to
451 The following environment variables affect the execution of
453 .Bl -tag -width BLOCKSIZE
455 If the environment variable
459 option is not specified, the block counts
464 will be displayed in units of that size block.
466 If this variable contains a string representing a
467 decimal integer, it is used as the
468 column position width for displaying
469 multiple-text-column output.
472 utility calculates how
473 many pathname text columns to display
474 based on the width provided.
478 The timezone to use when displaying dates.
481 for more information.
486 The group field is now automatically included in the long listing for
487 files in order to be compatible with the
501 utility is expected to be a superset of the