ls

Name

ls -- list directory contents

Description

The specification for "ls" is as declared by the SUS, but with the following differences listed below.

Differences

-c

when -l is used with this option the sort order is by name, rather than by ctime as the SUS requires.

-d

this option applies to entries in the file system specified on the command line. Normally when such options are directories, the contents of the directory are listed along with the directory. When this option is present these command line entries will be treated as though they were normal files, and their contents will not be listed.

The SUS makes no mention that this behavior pertains to command line entries, and only specifies behavior already otherwise present without the option. The SUS makes no implication of any additional behavior aside from that already specified.

The behavior of the Linux version of ls is entirely unexpected, given either SUS or the completely specified behavior presented above. Aside from the parent directory, the -d option for ls lists only those items specified on the command line, listing only the names of directories, and not their contents, but listing nothing else in this file system path that is not specified by the command line file list.

-p

as well as the slash declared by SUS, this option will also display the *, @, and | characters for executables, links, and FIFOs, respectively.

-u

when used with the -l option, the sort order is by name, rather than the SUS declared behavior of sorting by last modified date.