1 .\" $NetBSD: ls.1,v 1.69 2011/04/02 08:38:56 mbalmer 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 AaBbCcdFfghikLlMmnopqRrSsTtuWwx1
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.
77 Include directory entries whose names begin with a
81 Force printing of non-graphic characters in file names as \exxx, where xxx
82 is the numeric value of the character in octal.
86 but use C escape codes whenever possible.
88 Force multi-column output; this is the default when output is to a terminal.
90 Use time when file status was last changed,
91 instead of time of last modification of the file for sorting
96 Directories are listed as plain files (not searched recursively) and
97 symbolic links in the argument list are not followed.
101 immediately after each pathname that is a directory,
104 after each that is executable,
107 after each symbolic link,
119 Output is not sorted.
123 except that the owner is not printed.
129 options, causing the sizes to be reported in bytes displayed in a human
136 For each file, print the file's file serial number (inode number).
140 option, causing the sizes to be reported in kilobytes.
145 flags overrides the previous flag.
151 For each file, if it's a link, evaluate file information and file type
152 of the referenced file and not the link itself; however still print
153 the link name, unless used with
157 (The lowercase letter
161 A total sum for all the file sizes is output on a line before the long
168 options, causing the sizes or block counts reported to be separated with
169 commas (or a locale appropriate separator) resulting in a more readable
176 Stream output format; list files across the page, separated by commas.
181 the owner and group IDs are displayed numerically rather than converting
182 to a owner or group name.
184 Include the file flags in a long
187 If no file flags are set,
192 for a list of possible flags and their meanings.)
196 immediately after each pathname that is a directory.
198 Force printing of non-printable characters in file names as
201 this is the default when output is to a terminal.
203 Recursively list subdirectories encountered.
205 Reverse the order of the sort to get reverse
206 lexicographical order or the smallest or oldest entries first.
208 Sort by size, largest file first.
210 Display the number of file system blocks actually used by each file, in units
215 where partial units are rounded up to the
217 If the output is to a terminal, a total sum for all the file
218 sizes is output on a line before the listing.
222 (the lowercase letter
224 option, display complete time information for the file, including
225 month, day, hour, minute, second, and year.
227 Sort by time modified (most recently modified
228 first) before sorting the operands by lexicographical
231 Use time of last access,
232 instead of last modification
233 of the file for sorting
238 Display whiteouts when scanning directories.
240 Force raw printing of non-printable characters.
241 This is the default when output is not to a terminal.
243 Multi-column output sorted across the page rather than down the page.
247 Force output to be one entry per line.
248 This is the default when output is not to a terminal.
257 options all override each other; the last one specified determines
258 the format used for non-printable characters.
268 options all override each other; the last one specified determines
269 the format used with the exception that if both
285 options override each other; the last one specified determines
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
308 option is given, the following information
309 is displayed for each file:
310 .Bl -item -offset indent -compact
324 number of bytes in the file
326 abbreviated month file was last modified
328 day-of-month file was last modified
330 hour and minute file was last modified
335 In addition, for each directory whose contents are displayed, the total
336 number of 512-byte blocks used by the files in the directory is displayed
337 on a line by itself immediately before the information for the files in the
340 If the owner or group names are not a known owner or group name,
344 the numeric ID's are displayed.
346 If the file is a character special or block special file,
347 the major and minor device numbers for the file are displayed
349 If the file is a symbolic link the pathname of the
350 linked-to file is preceded by
353 The file mode printed under the
355 option consists of the entry type, owner permissions, group
356 permissions, and other permissions.
357 The entry type character describes the type of file, as
360 .Bl -tag -width 4n -offset indent -compact
368 Character special file.
383 The next three fields
384 are three characters each:
386 group permissions, and
388 Each field has three character positions:
389 .Bl -enum -offset indent
393 the file is readable; if
399 the file is writable; if
403 The first of the following that applies:
404 .Bl -tag -width 4n -offset indent
406 If in the owner permissions, the file is not executable and
407 set-user-ID mode is set.
408 If in the group permissions, the file is not executable
409 and set-group-ID mode is set.
411 If in the owner permissions, the file is executable
412 and set-user-ID mode is set.
413 If in the group permissions, the file is executable
414 and setgroup-ID mode is set.
416 The file is executable or the directory is
419 The file is neither readable, writable, executable,
420 nor set-user-ID nor set-group-ID mode, nor sticky.
424 These next two apply only to the third character in the last group
426 .Bl -tag -width 4n -offset indent
428 The sticky bit is set
431 but not execute or search permission.
437 The sticky bit is set (mode
439 and is searchable or executable.
447 The number of bytes displayed for a directory is a function of the
450 structures in the directory, not all of which may be allocated to
453 The following environment variables affect the execution of
455 .Bl -tag -width BLOCKSIZE
457 If the environment variable
463 options are not specified, the block counts
466 will be displayed in units of that size block.
468 If this variable contains a string representing a
469 decimal integer, it is used as the
470 column position width for displaying
471 multiple-text-column output.
474 utility calculates how
475 many pathname text columns to display
476 based on the width provided.
480 The timezone to use when displaying dates.
483 for more information.
488 The group field is now automatically included in the long listing for
489 files in order to be compatible with the
503 utility is expected to be a superset of the