first pass for new make
[unix-history] / usr / src / bin / ls / ls.1
... / ...
CommitLineData
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.12 (Berkeley) %G%
6.\"
7.TH LS 1 ""
8.UC
9.SH NAME
10ls \- list contents of directory
11.SH SYNOPSIS
12.B ls
13[
14.B \-1AaCcdFfgikLlqRrstu
15] [ file ... ]
16.br
17.SH DESCRIPTION
18For each directory argument,
19.I ls
20lists the contents of the directory;
21for each file argument,
22.I ls
23repeats its name and any other information requested.
24By default, the output is sorted alphabetically.
25When no argument is given, the current directory is listed.
26When several arguments are given,
27the arguments are first sorted appropriately,
28but file arguments are processed
29before directories and their contents.
30.PP
31The options are as follows:
32.TP
33.B \-1
34force one entry per line output format; this is the default when
35output is not to a terminal.
36.TP
37.B \-A
38List all entries except for ``.'' and ``..''.
39Always set for the super-user.
40.TP
41.B \-a
42List all entries; in the absence of this option, entries whose
43names begin with a period
44.RB ( . )
45are
46.I not
47listed.
48.TP
49.B \-C
50force multi-column output; this is the default when output is to a terminal.
51.TP
52.B \-c
53Use time when file status was last changed for sorting or printing.
54.TP
55.B \-d
56If argument is a directory, list only its name;
57often used with \fB\-l\fR to get the status of a directory.
58.TP
59.B \-f
60Don't sort the output.
61.TP
62.B \-F
63cause directories to be marked with a trailing `/',
64sockets with a trailing `=',
65symbolic links with a trailing `@', and executable
66files with a trailing `*'.
67.TP
68.B \-g
69Include the group ownership of the file in a long output.
70.TP
71.B \-i
72For each file, print the i-number in the first column of the report.
73.TP
74.B -k
75Modifies the
76.I -s
77option, causing the sizes to be reported in kilobytes.
78.TP
79.B \-L
80If argument is a symbolic link, list the file or directory the link references
81rather than the link itself.
82.TP
83.B \-l
84List in long format, giving type and mode (in the format described by
85.IR strmode (3)),
86number of links, owner, size in bytes, and time of last modification
87for each file.
88If the file is a special file the size field will instead contain
89the major and minor device numbers.
90If the file is a symbolic link the pathname of
91the linked-to file is printed preceded by ``\->''.
92.TP
93.B \-q
94force printing of non-graphic characters in file names as
95the character `?'; this is the default when output is to a terminal.
96.TP
97.B \-R
98recursively list subdirectories encountered.
99.TP
100.B \-r
101Reverse the order of sort to get reverse alphabetic
102or oldest first as appropriate.
103.TP
104.B \-s
105Display the sizes of files and directories in 512-byte blocks.
106.TP
107.B \-t
108Sort by time modified (latest first) instead of
109by name.
110.TP
111.B \-u
112Use time of last access instead of last
113modification for sorting
114(with the \fB\-t\fP option)
115and/or printing (with the \fB\-l\fP option).
116.PP
117The
118.IR -1 ,
119.IR -C ,
120and
121.I -l
122options all override each other; the last one specified determines
123the format used.
124.PP
125The
126.IR -c ,
127and
128.I -u
129options override each other; the last one specified determines
130the file time used.
131.PP
132When the sizes of the files in a directory
133are listed, a total count of blocks,
134including indirect blocks is printed.
135.SH FILES
136/etc/passwd to get user id's for
137`ls \-l'.
138.br
139/etc/group to get group id's for
140`ls \-g'.
141.SH BUGS
142The option setting based on whether the output is a teletype is
143undesirable as ``ls\ \-s'' is much different than ``ls\ \-s\ |\ lpr''.
144On the other hand, not doing this setting would make old shell scripts
145which used
146.I ls
147almost certain losers.