1LS(1) General Commands Manual LS(1)
2
3
4
6 ls - list contents of directory
7
9 ls [ -ltasdrucifg ] 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. The output is sorted alphabetically by default. 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 appear before directories and their contents. There are sev‐
18 eral options:
19
20 -l List in long format, giving mode, number of links, owner, size
21 in bytes, and time of last modification for each file. (See
22 below.) If the file is a special file the size field will
23 instead contain the major and minor device numbers.
24
25 -t Sort by time modified (latest first) instead of by name, as is
26 normal.
27
28 -a List all entries; usually `.' and `..' are suppressed.
29
30 -s Give size in blocks, including indirect blocks, for each entry.
31
32 -d If argument is a directory, list only its name, not its contents
33 (mostly used with -l to get status on directory).
34
35 -r Reverse the order of sort to get reverse alphabetic or oldest
36 first as appropriate.
37
38 -u Use time of last access instead of last modification for sorting
39 (-t) or printing (-l).
40
41 -c Use time of last modification to inode (mode, etc.) instead of
42 last modification to file for sorting (-t) or printing (-l).
43
44 -i Print i-number in first column of the report for each file
45 listed.
46
47 -f Force each argument to be interpreted as a directory and list
48 the name found in each slot. This option turns off -l, -t, -s,
49 and -r, and turns on -a; the order is the order in which entries
50 appear in the directory.
51
52 -g Give group ID instead of owner ID in long listing.
53
54 The mode printed under the -l option contains 11 characters which are
55 interpreted as follows: the first character is
56
57 d if the entry is a directory;
58 b if the entry is a block-type special file;
59 c if the entry is a character-type special file;
60 - if the entry is a plain file.
61
62 The next 9 characters are interpreted as three sets of three bits each.
63 The first set refers to owner permissions; the next to permissions to
64 others in the same user-group; and the last to all others. Within each
65 set the three characters indicate permission respectively to read, to
66 write, or to execute the file as a program. For a directory, `execute'
67 permission is interpreted to mean permission to search the directory
68 for a specified file. The permissions are indicated as follows:
69
70 r if the file is readable;
71 w if the file is writable;
72 x if the file is executable;
73 - if the indicated permission is not granted.
74
75 The group-execute permission character is given as s if the file has
76 set-group-ID mode; likewise the user-execute permission character is
77 given as s if the file has set-user-ID mode.
78
79 The last character of the mode (normally `x' or `-') is t if the 1000
80 bit of the mode is on. See chmod(1) for the meaning of this mode.
81
82 When the sizes of the files in a directory are listed, a total count of
83 blocks, including indirect blocks is printed.
84
86 /etc/passwd to get user ID's for `ls -l'.
87 /etc/group to get group ID's for `ls -g'.
88
89
90
91 LS(1)