[Top] [Prev] [Next]

ls - list contents of directory


For each directory argument, ls lists to the standard output the contents of the directory. For each file argument, ls repeats its name and any other information requested. When no argument is given, the current directory is listed.

If a named file does not exist, an error message is sent to the standard error.


There are a number format/content options:

List directory names.


List in long format, giving mode (see The Long Format)


Print only the final path element of each file name.


Include the qid (see stat, fstat, fwstat, wstat - get and put file status in Chapter 8) of each file.

By default, the output is sorted alphabetically by name. Sorting options are as follows:

Reverse the order of sort.


Sort by size.


Sort by time modified (latest first)


Sort by time of last access

The Long Format

The information given with the -l format consists of eight fields:

The mode field contains ten characters. The first character is


if the entry is a directory;


if the entry is a plain file.

The remaining nine characters are interpreted as three sets of three bits each.

The first set refers to owner (uid) permissions.

The next set to permissions to those in the same user-group (gid).

The last set refers to permissions for all others.

Within each set the three characters indicate permission respectively to read, to write, or to execute the file as a program.

For a directory, `execute' permission means permission to search the directory for a specified file.

The permissions are indicated as follows:


if the file is readable;


if the file is writable;


if the file is executable;


if none of the above permissions is granted.


The device type for the file, a single character representing the root of a file tree implemented by a particular kernel device driver.

device number

A number provided by the file system server.


The user identity string.


The group identity string.


The size of the file in bytes.

modification time

The modification time of the file formatted per Daytime->filet:
files less than 6 months old -
appear with month, day-of-month, and time-of-day
files over 6 months old -
show appear with month, day-of-month, and year


The file name.


The sorting options correspond to the sortkey options of the readdir module. See readdir - read directory and sort files in Chapter 15.

See Also
stat, fstat, fwstat, wstat - get and put file status in Chapter 8

Inferno Devices in Chapter 2

stat, wstat - inquire or change file attributes in Chapter 3

[Top] [Prev] [Next]

Copyright © 1996,Lucent Technologies, Inc. All rights reserved.