Blob


1 .TH LS 1
2 .SH NAME
3 ls, lc \- list contents of directory
4 .SH SYNOPSIS
5 .B ls
6 [
7 .B -dlmnpqrstuFQ
8 ]
9 .I name ...
10 .PP
11 .B lc
12 [
13 .B -dlmnpqrstuFQ
14 ]
15 .I name ...
16 .SH DESCRIPTION
17 For each directory argument,
18 .I ls
19 lists the contents of the directory;
20 for each file argument,
21 .I ls
22 repeats its name and any other information requested.
23 When no argument is given, the current directory is listed.
24 By default, the output is sorted alphabetically by name.
25 .PP
26 .I Lc
27 is the same as
28 .IR ls ,
29 but sets the
30 .B -p
31 option and pipes the output through
32 .MR mc (1) .
33 .PP
34 There are a number of options:
35 .TP
36 .B -d
37 If argument is a directory, list it, not
38 its contents.
39 .TP
40 .B -l
41 List in long format, giving mode (see below), file system type
42 (e.g., for devices, the
43 .B #
44 code letter that names it; see
45 .MR intro (3) ),
46 the instance or subdevice number, owner, group,
47 size in bytes, and time of last modification
48 for each file.
49 .TP
50 .B -m
51 List the name of the user who most recently modified the file.
52 .TP
53 .B -n
54 Don't sort the listing.
55 .TP
56 .B -p
57 Print only the final path element of each file name.
58 .TP
59 .B -q
60 List the
61 .I qid
62 (see
63 .MR stat (3) )
64 of each file; the printed fields are in the order
65 path, version, and type.
66 .TP
67 .B -r
68 Reverse the order of sort.
69 .TP
70 .B -s
71 Give size in Kbytes for each entry.
72 .TP
73 .B -t
74 Sort by time modified (latest first) instead of
75 by name.
76 .TP
77 .B -u
78 Under
79 .B -t
80 sort by time of last access;
81 under
82 .B -l
83 print time of last access.
84 .TP
85 .B -F
86 Add the character
87 .B /
88 after all directory names
89 and the character
90 .B *
91 after all executable files.
92 .TP
93 .B -L
94 Print the character
95 .B t
96 before each file if it has the temporary flag set, and
97 .B -
98 otherwise.
99 .TP
100 .B -Q
101 By default, printed file names are quoted if they contain characters special to
102 .MR rc (1) .
103 The
104 .B -Q
105 flag disables this behavior.
106 .PP
107 The mode printed under the
108 .B -l
109 option contains 11 characters,
110 interpreted
111 as follows:
112 the first character is
113 .TP
114 .B d
115 if the entry is a directory;
116 .TP
117 .B a
118 if the entry is an append-only file;
119 .TP
120 .B D
121 if the entry is a Unix device;
122 .TP
123 .B L
124 if the entry is a symbolic link;
125 .TP
126 .B P
127 if the entry is a named pipe;
128 .TP
129 .B S
130 if the entry is a socket;
131 .TP
132 .B -
133 if the entry is a plain file.
134 .PD
135 .PP
136 The next letter is
137 .B l
138 if the file is exclusive access (one writer or reader at a time).
139 .PP
140 The last 9 characters are interpreted
141 as three sets of three bits each.
142 The first set refers to owner permissions;
143 the next to permissions to others in the same user-group;
144 and the last to all others.
145 Within each set the three characters indicate
146 permission respectively to read, to write, or to
147 execute the file as a program.
148 For a directory, `execute' permission is interpreted
149 to mean permission to search the directory
150 for a specified file.
151 The permissions are indicated as follows:
152 .TP 3
153 .B r
154 if the file is readable;
155 .PD 0
156 .TP 3
157 .B w
158 if the file is writable;
159 .TP 3
160 .B x
161 if the file is executable;
162 .TP 3
163 .B -
164 if none of the above permissions is granted.
165 .PD
166 .SH SOURCE
167 .B \*9/src/cmd/ls.c
168 .br
169 .B \*9/bin/lc
170 .SH SEE ALSO
171 .MR stat (3) ,
172 .MR mc (1)