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