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