[Top] [Prev] [Next]

ls - list contents of directory

Description

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.

Options

There are a number format/content options:
-d

List directory names.

-l

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

-p

Print only the final path element of each file name.

-q

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:
-r

Reverse the order of sort.

-s

Sort by size.

-t

Sort by time modified (latest first)

-u

Sort by time of last access

The Long Format

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

The mode field contains ten characters. The first character is

d

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:

r

if the file is readable;

w

if the file is writable;

x

if the file is executable;

-

if none of the above permissions is granted.

devtype

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.

uid

The user identity string.

gid

The group identity string.

size

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

name

The file name.

Notes

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]

infernosupport@lucent.com
Copyright © 1996,Lucent Technologies, Inc. All rights reserved.