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