summaryrefslogtreecommitdiff
path: root/static/v10/man1/ls.1
blob: eb49b736c2bed8e1a8c6a84fcbf2cc906fe19e8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
.TH LS 1
.CT 1 files dirs
.SH NAME
ls, lc \(mi list contents of directory
.SH SYNOPSIS
.B ls
[
.B -acdfilrstuFLR
]
.I name ...
.PP
.B lc
[
.I options
]
.I name ...
.SH DESCRIPTION
For each directory argument,
.I ls
lists the contents of the directory;
for each file argument,
.I ls
repeats its name and any other information requested.
The output is sorted alphabetically by default.
When no argument is given, the current directory is listed.
When several arguments are given,
the arguments are first sorted,
but file arguments appear
before directories and their contents.
.PP
There are an unbelievable number of options:
.TP
.B  -l
List in long format, giving mode (see below), number of links, owner,
group,
size in bytes, and time of last modification
for each file.
Symbolic links are identified by a link count marked 
.LR L ;
the link count is that of the ultimate file.
If the file is a special file the size field will instead contain
the major and minor device numbers.
.TP
.B  -d
If argument is a directory, list its name, not
its contents.
.TP
.B  -t
Sort by time modified (latest first) instead of
by name, as is normal.
.TP
.B -L
Under
.B -l
for each symbolic link
give the immediate, not the ultimate, link count
and append the name pointed to.
.TP
.B  -a
List all entries; usually
.F .
and
.F ..
are suppressed.
.TP
.B  -c
Under
.B -t
sort by time of inode change;
under
.B -l
print time of inode change.
.TP
.B  -f
Force each argument to be interpreted as a directory
and list the name found in each slot.
This option turns off
.BR -l ", " -t ", " -s ,
and
.BR -r ,
and
turns on
.BR -a ;
the order is the order in which entries
appear in the directory.
.TP
.B  -F
cause directories to be marked with a trailing 
.L /
and executable
files to be marked with a trailing 
.L *
.TP
.B  -i
Print i-number in first column
of the report for each file listed.
.TP
.B  -r
Reverse the order of sort to get reverse alphabetic
or oldest first as appropriate.
.TP
.B  -R
recursively list subdirectories encountered.
.TP
.B  -s
Give size in Kbytes for each entry.
.TP
.B  -u
Under
.B -t
sort by time of last access;
under
.B -l
print time of last access.
.PP
The mode printed under the
.B -l
option contains 11 characters
which are interpreted
as follows:
the first character is
.TP
.B  d
if the entry is a directory;
.PD 0
.TP
.B  b
if the entry is a block-type special file;
.TP
.B  c
if the entry is a character-type special file;
.TP
.B l
if the entry is a symbolic link and option
.B -L
is in effect;
.TP
.B  -
if the entry is a plain file.
.PD
.PP
The next 9 characters are interpreted
as three sets of three bits each.
The first set refers to owner permissions;
the next to permissions to others in the same user-group;
and the last to all others.
Within each set the three characters indicate
permission respectively to read, to write, or to
execute the file as a program.
For a directory, `execute' permission is interpreted
to mean permission to search the directory
for a specified file.
The permissions are indicated as follows:
.TP 3
.B  r
if the file is readable;
.PD 0
.TP 3
.B  w
if the file is writable;
.TP 3
.B  x
if the file is executable;
.TP 3
.B  -
if the indicated permission is not granted.
.PD
.PP
The group-execute permission character is given
as
.B s
if the file has set-group-ID mode;
likewise the user-execute permission character is given
as
.B s
if the file has set-user-ID mode.
.PP
The last character of the mode (normally a blank)
indicates the type of concurrency control:
.TP
.B  e
if the file is set for exclusive access (1 writer or
.I n
readers);
.PD 0
.TP
.B  y
if the file is set for synchronized access (1 writer and
.I n
readers);
.PD 0
.TP
.B  a
if the file is set for append-only (all writes happen at end);
.PD 0
.TP
.B  b
if the file is blinded.
(Blind directories are unreadable.)
.PD
.PP
.I Lc
is the same as
.I ls,
but prints the list in multiple columns.
.SH FILES
.FR /etc/passwd
.br
.FR /etc/group
.SH SEE ALSO
.IR stat (2)
.SH BUGS
Option
.B -s
counts unwritten holes as if they were real data.