|
|
1.1 root 1: .TH LS 1 "28 July 1983"
2: .UC 4
3: .SH NAME
4: ls \- list contents of directory
5: .SH SYNOPSIS
6: .B ls
7: [
8: .B \-acdfgilqrstu1ACLFR
9: ] name ...
10: .br
11: .SH DESCRIPTION
12: For each directory argument,
13: .I ls
14: lists the contents of the directory;
15: for each file argument,
16: .I ls
17: repeats its name and any other information requested.
18: By default, the output is sorted alphabetically.
19: When no argument is given, the current directory is listed.
20: When several arguments are given,
21: the arguments are first sorted appropriately,
22: but file arguments are processed
23: before directories and their contents.
24: .PP
25: There are a large number of options:
26: .TP
27: .B \-l
28: List in long format, giving mode, number of links, owner,
29: size in bytes, and time of last modification
30: for each file.
31: (See below.)
1.1.1.2 ! root 32: If the file is a special file the size field instead contains
1.1 root 33: the major and minor device numbers.
34: If the file is a symbolic link the pathname of
35: the linked-to file is printed preceded by ``\->''.
36: .TP
37: .B \-g
38: Include the group ownership of the file in a long output.
39: .TP
40: .B \-t
41: Sort by time modified (latest first) instead of
42: by name.
43: .TP
44: .B \-a
45: List all entries; in the absence of this option, entries whose
46: names begin with a period
47: .RB ( . )
48: are
49: .I not
50: listed.
51: .TP
52: .B \-s
53: Give size in kilobytes of each file.
54: .TP
55: .B \-d
56: If argument is a directory, list only its name;
57: often used with \fB\-l\fR to get the status of a directory.
58: .TP
59: .B \-L
60: If argument is a symbolic link, list the file or directory the link references
61: rather than the link itself.
62: .TP
63: .B \-r
64: Reverse the order of sort to get reverse alphabetic
65: or oldest first as appropriate.
66: .TP
67: .B \-u
68: Use time of last access instead of last
69: modification for sorting
70: (with the \fB\-t\fP option)
71: and/or printing (with the \fB\-l\fP option).
72: .TP
73: .B \-c
74: Use time of file creation for sorting or printing.
75: .TP
76: .B \-i
77: For each file, print the i-number in the first column of the report.
78: .TP
79: .B \-f
80: Force each argument to be interpreted as a directory
81: and list the name found in each slot.
82: This option turns off
83: .B "\-l, \-t, \-s,"
84: and
85: .B \-r,
86: and
87: turns on
88: .B \-a;
89: the order is the order in which entries
90: appear in the directory.
91: .TP
92: .B \-F
93: cause directories to be marked with a trailing `/',
94: sockets with a trailing `=',
95: symbolic links with a trailing `@', and executable
96: files with a trailing `*'.
97: .TP
98: .B \-R
99: recursively list subdirectories encountered.
100: .TP
101: .B \-1
102: force one entry per line output format; this is the default when
103: output is not to a terminal.
104: .TP
105: .B \-C
106: force multi-column output; this is the default when output is to a terminal.
107: .TP
108: .B \-q
109: force printing of non-graphic characters in file names as
110: the character `?'; this is the default when output is to a terminal.
111: .PP
112: The mode printed under the
113: .B \-l
114: option contains 11 characters
115: which are interpreted
116: as follows:
117: the first character is
118: .TP 3
119: .B d
120: if the entry is a directory;
121: .br
122: .ns
123: .TP 3
124: .B b
125: if the entry is a block-type special file;
126: .br
127: .ns
128: .TP 3
129: .B c
130: if the entry is a character-type special file;
131: .br
132: .ns
133: .TP 3
134: .B l
135: if the entry is a symbolic link;
136: .br
137: .ns
138: .TP
139: .B s
140: if the entry is a socket, or
141: .br
142: .ns
143: .TP 3
144: .B \-
145: if the entry is a plain file.
146: .PP
147: The next 9 characters are interpreted
148: as three sets of three bits each.
149: The first set refers to owner permissions;
150: the next to permissions to others in the same user-group;
151: and the last to all others.
152: Within each set the three characters indicate
153: permission respectively to read, to write, or to
154: execute the file as a program.
155: For a directory, `execute' permission is interpreted
156: to mean permission to search the directory.
157: The permissions are indicated as follows:
158: .TP 3
159: .B r
160: if the file is readable;
161: .br
162: .ns
163: .TP 3
164: .B w
165: if the file is writable;
166: .br
167: .ns
168: .TP 3
169: .B x
170: if the file is executable;
171: .br
172: .ns
173: .TP 3
174: .B \-
175: if the indicated permission is not granted.
176: .PP
177: The group-execute permission character is given
178: as
179: .B s
180: if the file has the set-group-id bit set;
181: likewise the user-execute permission character is given
182: as
183: .B s
184: if the file has the set-user-id bit set.
185: .PP
186: The last character of the mode (normally `x' or `\-') is
187: .B t
188: if the 1000 bit of the mode is on.
189: See
190: .IR chmod (1)
191: for the meaning of this mode.
192: .PP
193: When the sizes of the files in a directory
194: are listed, a total count of blocks,
195: including indirect blocks is printed.
196: .SH FILES
197: /etc/passwd to get user id's for
198: `ls \-l'.
199: .br
200: /etc/group to get group id's for
201: `ls \-g'.
202: .SH BUGS
203: Newline and tab are considered printing characters in file names.
204: .PP
205: The output device is assumed to be 80 columns wide.
206: .PP
207: The option setting based on whether the output is a teletype is
208: undesirable as ``ls\ \-s'' is much different than ``ls\ \-s\ |\ lpr''.
209: On the other hand, not doing this setting would make old shell scripts
210: which used
211: .I ls
212: almost certain losers.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.