1 .\" $NetBSD: ls.1,v 1.62 2006/09/22 23:00:32 elad 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
35 .Dd September 25, 2008
40 .Nd list directory contents
43 .Op Fl AaBbCcdFfghikLlmnopqRrSsTtuWwx1
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 \\xxx, 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 indirected through.
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
134 For each file, print the file's file serial number (inode number).
138 option, causing the sizes to be reported in kilobytes.
143 flags overrides the previous flag.
147 For each file, if it's a link, evaluate file information and file type
148 of the referenced file and not the link itself; however still print
149 the link name, unless used with
153 (The lowercase letter
157 A total sum for all the file sizes is output on a line before the long
160 Stream output format; list files across the page, separated by commas.
165 the owner and group IDs are displayed numerically rather than converting
166 to a owner or group name.
168 Include the file flags in a long
171 If no file flags are set,
176 for a list of possible flags and their meanings.)
180 immediately after each pathname that is a directory.
182 Force printing of non-printable characters in file names as
185 this is the default when output is to a terminal.
187 Recursively list subdirectories encountered.
189 Reverse the order of the sort to get reverse
190 lexicographical order or the smallest or oldest entries first.
192 Sort by size, largest file first.
194 Display the number of file system blocks actually used by each file, in units
199 where partial units are rounded up to the
201 If the output is to a terminal, a total sum for all the file
202 sizes is output on a line before the listing.
206 (the lowercase letter
208 option, display complete time information for the file, including
209 month, day, hour, minute, second, and year.
211 Sort by time modified (most recently modified
212 first) before sorting the operands by lexicographical
215 Use time of last access,
216 instead of last modification
217 of the file for sorting
222 Display whiteouts when scanning directories.
224 Force raw printing of non-printable characters.
225 This is the default when output is not to a terminal.
227 Multi-column output sorted across the page rather than down the page.
231 Force output to be one entry per line.
232 This is the default when output is not to a terminal.
241 options all override each other; the last one specified determines
242 the format used for non-printable characters.
252 options all override each other; the last one specified determines
253 the format used with the exception that if both
269 options override each other; the last one specified determines
274 lists one entry per line to standard
275 output; the exceptions are to terminals or when the
279 options are specified.
281 File information is displayed with one or more
283 separating the information associated with the
292 option is given, the following information
293 is displayed for each file:
294 .Bl -item -offset indent -compact
308 number of bytes in the file
310 abbreviated month file was last modified
312 day-of-month file was last modified
314 hour and minute file was last modified
319 In addition, for each directory whose contents are displayed, the total
320 number of 512-byte blocks used by the files in the directory is displayed
321 on a line by itself immediately before the information for the files in the
324 If the owner or group names are not a known owner or group name,
328 the numeric ID's are displayed.
330 If the file is a character special or block special file,
331 the major and minor device numbers for the file are displayed
333 If the file is a symbolic link the pathname of the
334 linked-to file is preceded by
337 The file mode printed under the
339 option consists of the entry type, owner permissions, group
340 permissions, and other permissions.
341 The entry type character describes the type of file, as
344 .Bl -tag -width 4n -offset indent -compact
352 Character special file.
367 The next three fields
368 are three characters each:
370 group permissions, and
372 Each field has three character positions:
373 .Bl -enum -offset indent
377 the file is readable; if
383 the file is writable; if
387 The first of the following that applies:
388 .Bl -tag -width 4n -offset indent
390 If in the owner permissions, the file is not executable and
391 set-user-ID mode is set.
392 If in the group permissions, the file is not executable
393 and set-group-ID mode is set.
395 If in the owner permissions, the file is executable
396 and set-user-ID mode is set.
397 If in the group permissions, the file is executable
398 and setgroup-ID mode is set.
400 The file is executable or the directory is
403 The file is neither readable, writable, executable,
404 nor set-user-ID nor set-group-ID mode, nor sticky.
408 These next two apply only to the third character in the last group
410 .Bl -tag -width 4n -offset indent
412 The sticky bit is set
415 but not execute or search permission.
421 The sticky bit is set (mode
423 and is searchable or executable.
431 The number of bytes displayed for a directory is a function of the
434 structures in the directory, not all of which may be allocated to
439 utility exits 0 on success, and \*[Gt]0 if an error occurs.
441 The following environment variables affect the execution of
443 .Bl -tag -width BLOCKSIZE
445 If the environment variable
451 options are not specified, the block counts
454 will be displayed in units of that size block.
456 If this variable contains a string representing a
457 decimal integer, it is used as the
458 column position width for displaying
459 multiple-text-column output.
462 utility calculates how
463 many pathname text columns to display
464 based on the width provided.
468 The timezone to use when displaying dates.
471 for more information.
474 The group field is now automatically included in the long listing for
475 files in order to be compatible with the
489 utility is expected to be a superset of the