LS(1V)

NAME
ls - list contents of directory

SYNOPSIS
/usr/5bin/ls [ -CFRabcdfgilmnopqrstux ] filename...

DESCRIPTION
For each filename which is a directory ls lists the contents of the directory; for each filename which is a file, ls displays the name of the file and any other requested information. If no filename is given, the current directory is listed. The output is normally sorted alphabetically. When several arguments are given, all the file arguments are handled before the directories.

There are three output formats. By default entries are listed one per line. Options -C and -x result in multi-column output, and -m enables a format where entries are listed across the page, separated by commas. ls determines the width of the output device by looking for the environment variable COLUMNS. If this does not exist, then it attempts to obtain the width from the tty driver. If this is unsuccessful, then a default value of 80 is used.

There are many options.

-C  Multi-column output

-F  Appends a character to certain filenames to indicate their types. Supported types are `/' (directory), `*' (executable) and `=' (socket).

-R  Recursively list subdirectories.

-a  List all entries; usually entries whose names begin with `.' are not listed.

-b  Display non-printing characters in octal notation.

-c  Use time of last modification for sorting (in conjunction with -t ) or printing (in conjunction with -l ).

-d  For directory arguments, list the name of the directory and not its contents. Useful with the -l option to obtain the status of a directory.

-f  Force each argument to be interpreted as a directory and list the name found in each slot. This option disables -l, -t, -s and -r and turns on -a; the files are presented in the order they occur in the directory.

-g  As -l except the owner is not displayed.

-i  Display each file's i-number in the first column.

-l  Long format. Display mode, number of links, owner, group, size in bytes, and time of last modification for each file. For special files, display the major and minor device numbers instead of a size.

-m  Stream output format; files are displayed across the page, separated with commas.

-n  As -l except the UID and GID numbers are printed instead of the owner and group names.

-o  As -l except the group is not printed.

-p  Display a `/' after each filename if it is a directory.

-q  Make non-printing characters in filenames display as the character `?'.

-r  Reverse the sorting order to get reverse alphabetic order, or oldest first order if used in conjunction with the -t option.

-s  Give the number of 512-byte blocks taken up by each file.

-t  Sort by last-modified time (newest first) instead of alphabetically.

-u  Use last access time instead of modification time for sorting (with -t) or printing (with -l).

-x  Display a multi-column format with entries sorted across the page instead of down the page.

When file sizes are listed, the total count of 512-byte blocks used is also displayed.

LONG LISTING FORMAT
The long format printed by -l displays the mode of the file in the first ten characters of the line.

The first character is:

d   if the entry is a directory

b   if it is a block special file

c   if it is a character special file

p   if it is a FIFO special file (named pipe)

-   if it is an ordinary file.

The next nine characters indicate permissions. The first three represent the owner's permissions, the middle three the group's permissions, and the final three permissions to other users. Within each set of three, the characters represent permission to read, write and execute respectively. 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 corresponding permission is denied.

If a file has the set-user-ID bit set, then the user-execute character is replaced with s, which is capitalised if the execute permission bit is not set. Similarly for the group-execute character of a set-group-ID file.

SYMBOLIC LINKS
An argument which is a symbolic link to a directory is normally followed, and the contents of the destination directory listed. However in long listing format, the link is not followed, and instead the name is displayed thus:

    /bin -> /usr/bin

SEE ALSO
ls(1) chmod(1) find(1)