2BSD/man/ls.u

.TH LS UCB 2/24/79 UCB
.SH NAME
ls \- list contents of directory
.SH SYNOPSIS
.B ls
[
options
] name ...
.SH DESCRIPTION
.IR Ls (UCB)
is similar to
.IR ls (1)
but has three possible listing formats.
The format chosen depends on whether the output is going
to a teletype, and may also be controlled by option flags.
The default format for a teletype is to list the contents of directories
in multi-column format, with the entries sorted down the columns.
(See also the
.B \-x
option below.)
If the standard output is not a teletype, the default format is to
list one entry per line.
This is the way
.IR ls (1)
always works.
Finally, there is a stream output format in which files are listed
across the page, separated by `,' characters.
The
.B \-m
flag enables this format.
.PP
.B "Note:"
Files which are not the contents of a directory being interpreted
are always sorted across the page rather than down the page in columns.
This is because the individual file names may be arbitrarily long.
.PP
New options are:
.TP 4
.B  \-m
force stream output format
.TP 4
.B  \-1
force one entry per line output format, e.g. to a teletype
.TP 4
.B  \-c
force multi-column output, e.g. to a file or a pipe
.TP 4
.B  \-q
force printing of non-graphic characters in file names as
the character `?'; this normally happens only if the output device is
a teletype
.TP 4
.B  \-x
force columnar printing to be sorted across rather than
down the page;
this is the default if the last character of the name the program is invoked
with is not an `l' or an `s'.
.SH SEE ALSO
ls(1), l(UCB)
.SH FILES
/etc/passwd to get user ID's for
.BR "ls \-l" "."
.SH BUGS
Newline and tab are considered printing characters in file names.
.PP
Output device is assumed to be 80 columns wide.
Columns are basically 15 characters wide, 20 characters wide if
.BR \-i " or " "\-s\fR is specified, 25 characters wide if both"
.BR \-i " and " "\-s\fR are specified."
In any case where
.BR \-l ""
or
.BR \-n ""
is specified, we assume
only one entry will fit per line.
.PP
The option setting based on whether the output is a teletype is
undesirable as:
.PP
.DT
	ls \-s | lpr
.PP
is much different than
.PP
	ls \-s
.PP
On the other hand, not doing this setting would make old shell scripts
which used
.I ls
almost certain losers,
and then one could no longer do, e.g.:
.PP
	ls \-s | sort \-nr
.PP
but would have to do
.PP
	ls \-s \-1 | sort \-nr
.PP
Column widths choices are poor for terminals which can tab.