Research V7 development
[unix-history] / usr / man / man1 / ls.1
CommitLineData
a67fedff
DR
1.TH LS 1
2.SH NAME
3ls \- list contents of directory
4.SH SYNOPSIS
5.B ls
6[
7.B \-ltasdrucifg
8] name ...
9.SH DESCRIPTION
10For each directory argument,
11.I ls
12lists the contents of the directory;
13for each file argument,
14.I ls
15repeats its name and any other information requested.
16The output is sorted alphabetically by default.
17When no argument is given, the current directory is listed.
18When several arguments are given,
19the arguments are first sorted appropriately,
20but file arguments appear
21before directories and their contents.
22There are several options:
23.TP
24.B \-l
25List in long format, giving mode, number of links, owner,
26size in bytes, and time of last modification
27for each file.
28(See below.)
29If the file is a special file the size field will instead contain
30the major and minor device numbers.
31.TP
32.B \-t
33Sort by time modified (latest first) instead of
34by name, as is normal.
35.TP
36.B \-a
37List all entries; usually
38.RB ` . '
39and
40.RB ` .. '
41are suppressed.
42.TP
43.B \-s
44Give size in blocks,
45including indirect blocks, for each entry.
46.TP
47.B \-d
48If argument is a directory, list only its name, not
49its contents (mostly used with
50.B \-l
51to get status
52on directory).
53.TP
54.B \-r
55Reverse the order of sort to get reverse alphabetic
56or oldest first as appropriate.
57.TP
58.B \-u
59Use time of last access instead of last
60modification for sorting
61.RB ( \-t )
62or printing
63.RB ( \-l ).
64.TP
65.B \-c
66Use time of last modification to inode (mode, etc.)
67instead of last modification to file for sorting
68.RB ( \-t )
69or printing
70.RB ( \-l ).
71.TP
72.B \-i
73Print i-number in first column
74of the report for each file listed.
75.TP
76.B \-f
77Force each argument to be interpreted as a directory
78and list the name found in each slot.
79This option turns off
80.B "\-l, \-t, \-s,"
81and
82.B \-r,
83and
84turns on
85.B \-a;
86the order is the order in which entries
87appear in the directory.
88.TP
89.B \-g
90Give group ID instead of owner ID in long listing.
91.PP
92The mode printed under the
93.B \-l
94option contains 11 characters
95which are interpreted
96as follows:
97the first character is
98.TP 3
99.B d
100if the entry is a directory;
101.br
102.ns
103.TP 3
104.B b
105if the entry is a block-type special file;
106.br
107.ns
108.TP 3
109.B c
110if the entry is a character-type special file;
111.br
112.ns
113.TP 3
114.B \-
115if the entry is a plain file.
116.PP
117The next 9 characters are interpreted
118as three sets of three bits each.
119The first set refers to owner permissions;
120the next to permissions to others in the same user-group;
121and the last to all others.
122Within each set the three characters indicate
123permission respectively to read, to write, or to
124execute the file as a program.
125For a directory, `execute' permission is interpreted
126to mean permission to search the directory
127for a specified file.
128The permissions are indicated as follows:
129.TP 3
130.B r
131if the file is readable;
132.br
133.ns
134.TP 3
135.B w
136if the file is writable;
137.br
138.ns
139.TP 3
140.B x
141if the file is executable;
142.br
143.ns
144.TP 3
145.B \-
146if the indicated permission is not granted.
147.PP
148The group-execute permission character is given
149as
150.B s
151if the file has set-group-ID mode;
152likewise the user-execute permission character is given
153as
154.B s
155if the file has set-user-ID mode.
156.PP
157The last character of the mode (normally `x' or `\-') is
158.B t
159if the 1000 bit of the mode is on.
160See
161.IR chmod (1)
162for the meaning of this mode.
163.PP
164When the sizes of the files in a directory
165are listed, a total count of blocks,
166including indirect blocks is printed.
167.SH FILES
168/etc/passwd to get user ID's for
169`ls \-l'.
170.br
171/etc/group to get group ID's for
172`ls \-g'.