BSD 2 development
[unix-history] / man / ls.u
CommitLineData
8c95d292
BJ
1.TH LS UCB 2/24/79 UCB
2.SH NAME
3ls \- list contents of directory
4.SH SYNOPSIS
5.B ls
6[
7options
8] name ...
9.SH DESCRIPTION
10.IR Ls (UCB)
11is similar to
12.IR ls (1)
13but has three possible listing formats.
14The format chosen depends on whether the output is going
15to a teletype, and may also be controlled by option flags.
16The default format for a teletype is to list the contents of directories
17in multi-column format, with the entries sorted down the columns.
18(See also the
19.B \-x
20option below.)
21If the standard output is not a teletype, the default format is to
22list one entry per line.
23This is the way
24.IR ls (1)
25always works.
26Finally, there is a stream output format in which files are listed
27across the page, separated by `,' characters.
28The
29.B \-m
30flag enables this format.
31.PP
32.B "Note:"
33Files which are not the contents of a directory being interpreted
34are always sorted across the page rather than down the page in columns.
35This is because the individual file names may be arbitrarily long.
36.PP
37New options are:
38.TP 4
39.B \-m
40force stream output format
41.TP 4
42.B \-1
43force one entry per line output format, e.g. to a teletype
44.TP 4
45.B \-c
46force multi-column output, e.g. to a file or a pipe
47.TP 4
48.B \-q
49force printing of non-graphic characters in file names as
50the character `?'; this normally happens only if the output device is
51a teletype
52.TP 4
53.B \-x
54force columnar printing to be sorted across rather than
55down the page;
56this is the default if the last character of the name the program is invoked
57with is not an `l' or an `s'.
58.SH SEE ALSO
59ls(1), l(UCB)
60.SH FILES
61/etc/passwd to get user ID's for
62.BR "ls \-l" "."
63.SH BUGS
64Newline and tab are considered printing characters in file names.
65.PP
66Output device is assumed to be 80 columns wide.
67Columns are basically 15 characters wide, 20 characters wide if
68.BR \-i " or " "\-s\fR is specified, 25 characters wide if both"
69.BR \-i " and " "\-s\fR are specified."
70In any case where
71.BR \-l ""
72or
73.BR \-n ""
74is specified, we assume
75only one entry will fit per line.
76.PP
77The option setting based on whether the output is a teletype is
78undesirable as:
79.PP
80.DT
81 ls \-s | lpr
82.PP
83is much different than
84.PP
85 ls \-s
86.PP
87On the other hand, not doing this setting would make old shell scripts
88which used
89.I ls
90almost certain losers,
91and then one could no longer do, e.g.:
92.PP
93 ls \-s | sort \-nr
94.PP
95but would have to do
96.PP
97 ls \-s \-1 | sort \-nr
98.PP
99Column widths choices are poor for terminals which can tab.