1LS(1) General Commands Manual LS(1)
2
3
4
6 ls - list contents of directory
7
9 ls [ -acdfgiloqrstu1ACLFR ] name ...
10
12 For each directory argument, ls lists the contents of the directory;
13 for each file argument, ls repeats its name and any other information
14 requested. By default, the output is sorted alphabetically. When no
15 argument is given, the current directory is listed. When several argu‐
16 ments are given, the arguments are first sorted appropriately, but file
17 arguments are processed before directories and their contents.
18
19 There are a large number of options:
20
21 -l List in long format, giving mode, number of links, owner, size
22 in bytes, and time of last modification for each file. (See
23 below.) If the file is a special file the size field will
24 instead contain the major and minor device numbers. If the file
25 is a symbolic link the pathname of the linked-to file is printed
26 preceded by ``->''.
27
28 -o Include the file flags in a long (-l) output.
29
30 -g Include the group ownership of the file in a long output.
31
32 -t Sort by time modified (latest first) instead of by name.
33
34 -a List all entries; in the absence of this option, entries whose
35 names begin with a period (.) are not listed.
36
37 -s Give size in kilobytes of each file.
38
39 -d If argument is a directory, list only its name; often used with
40 -l to get the status of a directory.
41
42 -L If argument is a symbolic link, list the file or directory the
43 link references rather than the link itself.
44
45 -r Reverse the order of sort to get reverse alphabetic or oldest
46 first as appropriate.
47
48 -u Use time of last access instead of last modification for sorting
49 (with the -t option) and/or printing (with the -l option).
50
51 -c Use time of file creation for sorting or printing.
52
53 -i For each file, print the i-number in the first column of the
54 report.
55
56 -f Output is not sorted.
57
58 -F cause directories to be marked with a trailing `/', sockets with
59 a trailing `=', symbolic links with a trailing `@', and exe‐
60 cutable files with a trailing `*'.
61
62 -R recursively list subdirectories encountered.
63
64 -1 force one entry per line output format; this is the default when
65 output is not to a terminal.
66
67 -C force multi-column output; this is the default when output is to
68 a terminal.
69
70 -q force printing of non-graphic characters in file names as the
71 character `?'; this is the default when output is to a terminal.
72
73 The mode printed under the -l option contains 11 characters which are
74 interpreted as follows: the first character is
75
76 d if the entry is a directory;
77 b if the entry is a block-type special file;
78 c if the entry is a character-type special file;
79 l if the entry is a symbolic link;
80 s if the entry is a socket, or
81 - if the entry is a plain file.
82
83 The next 9 characters are interpreted as three sets of three bits each.
84 The first set refers to owner permissions; the next refers to permis‐
85 sions to others in the same user-group; and the last to all others.
86 Within each set the three characters indicate permission respectively
87 to read, to write, or to execute the file as a program. For a direc‐
88 tory, `execute' permission is interpreted to mean permission to search
89 the directory. The permissions are indicated as follows:
90
91 r if the file is readable;
92 w if the file is writable;
93 x if the file is executable;
94 - if the indicated permission is not granted.
95
96 The group-execute permission character is given as s if the file has
97 the set-group-id bit set; likewise the user-execute permission charac‐
98 ter is given as s if the file has the set-user-id bit set.
99
100 The last character of the mode (normally `x' or `-') is t if the 1000
101 bit of the mode is on. See chmod(1) for the meaning of this mode.
102
103 When the sizes of the files in a directory are listed, a total count of
104 blocks, including indirect blocks is printed.
105
107 /etc/passwd to get user id's for `ls -l'.
108 /etc/group to get group id's for `ls -g'.
109
111 Newline and tab are considered printing characters in file names.
112
113 The output device is assumed to be 80 columns wide.
114
115 The option setting based on whether the output is a teletype is unde‐
116 sirable as ``ls -s'' is much different than ``ls -s | lpr''. On the
117 other hand, not doing this setting would make old shell scripts which
118 used ls almost certain losers.
119
120
121
1223rd Berkeley Distribution December 20, 1994 LS(1)