BSD 4_4_Lite2 development
[unix-history] / usr / share / man / cat1 / ls.0
CommitLineData
32424d04
C
1LS(1) BSD Reference Manual LS(1)
2
3N\bNA\bAM\bME\bE
4 l\bls\bs - list directory contents
5
6S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
7 l\bls\bs [-\b-A\bAC\bCF\bFL\bLR\bRT\bTW\bWa\bac\bcd\bdf\bfi\bil\blo\boq\bqr\brs\bst\btu\bu1\b1] [_\bf_\bi_\bl_\be _\b._\b._\b.]
8
9D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
10 For each operand that names a _\bf_\bi_\bl_\be of a type other than directory, l\bls\bs
11 displays its name as well as any requested, associated information. For
12 each operand that names a _\bf_\bi_\bl_\be of type directory, l\bls\bs displays the names
13 of files contained within that directory, as well as any requested, asso-
14 ciated information.
15
16 If no operands are given, the contents of the current directory are dis-
17 played. If more than one operand is given, non-directory operands are
18 displayed first; directory and non-directory operands are sorted sepa-
19 rately and in lexicographical order.
20
21 The following options are available:
22
23 -\b-A\bA List all entries except for `.' and `..'. Always set for the su-
24 per-user.
25
26 -\b-C\bC Force multi-column output; this is the default when output is to
27 a terminal.
28
29 -\b-F\bF Display a slash (/) immediately after each pathname that is a di-
30 rectory, an asterisk (*) after each that is executable, an at
31 sign (@) after each symbolic link, and a percent sign (%) after
32 each whiteout.
33
34 -\b-L\bL If argument is a symbolic link, list the file or directory the
35 link references rather than the link itself.
36
37 -\b-R\bR Recursively list subdirectories encountered.
38
39 -\b-T\bT Display complete time information for the file, including month,
40 day, hour, minute, second, and year.
41
42 -\b-W\bW Display whiteouts when scanning directories.
43
44 -\b-a\ba Include directory entries whose names begin with a dot (.).
45
46 -\b-c\bc Use time when file status was last changed for sorting or print-
47 ing.
48
49 -\b-d\bd Directories are listed as plain files (not searched recursively)
50 and symbolic links in the argument list are not indirected
51 through.
52
53 -\b-f\bf Output is not sorted.
54
55 -\b-i\bi For each file, print the file's file serial number (inode num-
56 ber).
57
58 -\b-l\bl (The lowercase letter ``ell.'') List in long format. (See be-
59 low.) If the output is to a terminal, a total sum for all the
60 file sizes is output on a line before the long listing.
61
62 -\b-o\bo Include the file flags in a long (-\b-l\bl) output
63
64 -\b-q\bq Force printing of non-graphic characters in file names as the
65 character `?'; this is the default when output is to a terminal.
66
67
68 -\b-r\br Reverse the order of the sort to get reverse lexicographical or-
69 der or the oldest entries first.
70
71 -\b-s\bs Display the number of file system blocks actually used by each
72 file, in units of 512 bytes, where partial units are rounded up
73 to the next integer value. If the output is to a terminal, a to-
74 tal sum for all the file sizes is output on a line before the
75 listing.
76
77 -\b-t\bt Sort by time modified (most recently modified first) before sort-
78 ing the operands by lexicographical order.
79
80 -\b-u\bu Use time of last access, instead of last modification of the file
81 for sorting (-\b-t\bt) or printing (-\b-l\bl).
82
83 -\b-1\b1 (The numeric digit ``one.'') Force output to be one entry per
84 line. This is the default when output is not to a terminal.
85
86 The -\b-1\b1, -\b-C\bC, and -\b-l\bl options all override each other; the last one speci-
87 fied determines the format used.
88
89 The -\b-c\bc, and -\b-u\bu options override each other; the last one specified deter-
90 mines the file time used.
91
92 By default, l\bls\bs lists one entry per line to standard output; the excep-
93 tions are to terminals or when the -\b-C\bC option is specified.
94
95 File information is displayed with one or more <blank>s separating the
96 information associated with the -\b-i\bi, -\b-s\bs, and -\b-l\bl options.
97
98 T\bTh\bhe\be L\bLo\bon\bng\bg F\bFo\bor\brm\bma\bat\bt
99 If the -\b-l\bl option is given, the following information is displayed for
100 each file: file mode, number of links, owner name, group name, number of
101 bytes in the file, abbreviated month, day-of-month file was last modi-
102 fied, hour file last modified, minute file last modified, and the path-
103 name. In addition, for each directory whose contents are displayed, the
104 total number of 512-byte blocks used by the files in the directory is
105 displayed on a line by itself immediately before the information for the
106 files in the directory.
107
108 If the owner or group names are not a known user or group name the numer-
109 ic ID's are displayed.
110
111 If the file is a character special or block special file, the major and
112 minor device numbers for the file are displayed in the size field. If the
113 file is a symbolic link the pathname of the linked-to file is preceded by
114 ``->''.
115
116 The file mode printed under the -l option consists of the entry type,
117 owner permissions, and group permissions. The entry type character de-
118 scribes the type of file, as follows:
119
120 b\bb Block special file.
121 c\bc Character special file.
122 d\bd Directory.
123 l\bl Symbolic link.
124 s\bs Socket link.
125 w\bw Whiteout.
126 -\b- Regular file.
127
128 The next three fields are three characters each: owner permissions, group
129 permissions, and other permissions. Each field has three character posi-
130
131
132 tions:
133
134 1. If r\br, the file is readable; if -\b-, it is not readable.
135
136 2. If w\bw, the file is writable; if -\b-, it is not writable.
137
138 3. The first of the following that applies:
139
140 S\bS If in the owner permissions, the file is not exe-
141 cutable and set-user-ID mode is set. If in the
142 group permissions, the file is not executable and
143 set-group-ID mode is set.
144
145 s\bs If in the owner permissions, the file is exe-
146 cutable and set-user-ID mode is set. If in the
147 group permissions, the file is executable and set-
148 group-ID mode is set.
149
150 x\bx The file is executable or the directory is search-
151 able.
152
153 -\b- The file is neither readable, writeable, exe-
154 cutable, nor set-user-ID nor set-group-ID mode,
155 nor sticky. (See below.)
156
157 These next two apply only to the third character in the last
158 group (other permissions).
159
160 T\bT The sticky bit is set (mode 1000), but not execute
161 or search permission. (See chmod(1) or sticky(8).)
162
163
164 t\bt The sticky bit is set (mode 1000), and is search-
165 able or executable. (See chmod(1) or sticky(8).)
166
167 The l\bls\bs utility exits 0 on success, and >0 if an error occurs.
168
169E\bEN\bNV\bVI\bIR\bRO\bON\bNM\bME\bEN\bNT\bTA\bAL\bL V\bVA\bAR\bRI\bIA\bAB\bBL\bLE\bES\bS
170 The following environment variables affect the execution of l\bls\bs:
171
172 BLOCKSIZE If the environmental variable BLOCKSIZE is set, the block
173 counts (see -\b-s\bs) will be displayed in units of that size block.
174
175 COLUMNS If this variable contains a string representing a decimal in-
176 teger, it is used as the column position width for displaying
177 multiple-text-column output. The l\bls\bs utility calculates how
178 many pathname text columns to display based on the width pro-
179 vided. (See -\b-C\bC.)
180
181 TZ The timezone to use when displaying dates. See environ(7) for
182 more information.
183
184C\bCO\bOM\bMP\bPA\bAT\bTI\bIB\bBI\bIL\bLI\bIT\bTY\bY
185 The group field is now automatically included in the long listing for
186 files in order to be compatible with the IEEE Std1003.2 (``POSIX'') spec-
187 ification.
188
189S\bSE\bEE\bE A\bAL\bLS\bSO\bO
190 chmod(1), symlink(7), sticky(8)
191
192H\bHI\bIS\bST\bTO\bOR\bRY\bY
193 An l\bls\bs command appeared in Version 6 AT&T UNIX.
194
195S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
196 The l\bls\bs function is expected to be a superset of the IEEE Std1003.2
197 (``POSIX'') specification.
198