Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(1)

find(1)

LS(1)  —  UNIX 3.0

NAME

ls − list contents of directories

SYNOPSIS

ls [ −logtasdrucif ] names

DESCRIPTION

For each directory named, ls lists the contents of that directory; for each file named, ls repeats its name and any other information requested.  By default, the output is sorted alphabetically.  When no argument is given, the current directory is listed.  When several arguments are given, the arguments are first sorted appropriately, but file arguments are processed before directories and their contents.  There are several options:

−l List in long format, giving mode, number of links, owner, group, size in bytes, and time of last modification for each file (see below).  If the file is a special file, the size field will contain the major and minor device numbers, rather than a size. 

−o The same as −l, except that the group is not printed. 

−g The same as −l, except that the owner is not printed. 

−t Sort by time of last modification (latest first) instead of by name. 

−a List all entries; in the absence of this option, entries whose names begin with a period (.) are not listed. 

−s Give size in blocks (including indirect blocks) for each entry. 

−d If argument is a directory, list only its name; often used with −l to get the status of a directory. 

−r Reverse the order of sort to get reverse alphabetic or oldest first, as appropriate. 

−u Use time of last access instead of last modification for sorting (with the −t option) and/or printing (with the −l option). 

−c Use time of last modification of the inode (mode, etc.)  instead of last modification of the file for sorting (−t) and/or printing (−l). 

−i For each file, print the i-number in the first column of the report. 

−f Force each argument to be interpreted as a directory and list the name found in each slot.  This option turns off −l, −t, −s, and −r, and turns on −a; the order is the order in which entries appear in the directory. 

The mode printed under the −l option consists of 11 characters that are interpreted as follows:

The first character is:

d if the entry is a directory;

b if the entry is a block special file;

c if the entry is a character special file;

p if the entry is a fifo (a.k.a. “named pipe”) special file;

− if the entry is an ordinary file. 

The next 9 characters are interpreted as three sets of three bits each.  The first set refers to the owner’s permissions; the next to permissions of others in the user-group of the file; and the last to all others.  Within each set, the three characters indicate permission to read, to write, and to execute the file as a program, respectively.  For a directory, “execute” permission is interpreted to mean permission to search the directory for a specified file. 
The permissions are indicated as follows:

r if the file is readable;

w if the file is writable;

x if the file is executable;

− if the indicated permission is not granted. 

The group-execute permission character is given as s if the file has set-group-ID mode; likewise, the user-execute permission character is given as s if the file has set-user-ID mode.  The last character of the mode (normally x or −) is t if the 1000 (octal) bit of the mode is on; see chmod(1) for the meaning of this mode. The indications of set-ID and 1000 bit of the mode are capitalized if the corresponding execute permission is not set. 

When the sizes of the files in a directory are listed, a total count of blocks, including indirect blocks, is printed. 

FILES

/etc/passwd to get user IDs for ls −l and ls −o. 

/etc/group to get group IDs for ls −l and ls −g. 

SEE ALSO

chmod(1), find(1). 

May 16, 1980

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026