Go to the first, previous, next, last section, table of contents.


ls: List directory contents

The ls program lists information about files (of any type, including directories). Options and file arguments can be intermixed arbitrarily, as usual.

For non-option command-line arguments that are directories, by default ls lists the contents of directories, not recursively, and omitting files with names beginning with .. For other non-option arguments, by default ls lists just the file name. If no non-option arguments are specified, ls lists the contents of the current directory.

By default, the output is sorted alphabetically. If standard output is a terminal, the output is in columns (sorted vertically); otherwise, they are listed one per line.

Because ls is such a fundamental program, it has accumulated many options over the years. They are described in the subsections below; within each section, options are listed alphabetically (ignoring case). The division of options into the subsections is not absolute, since some options affect more than one aspect of ls's operation.

The `-g' option is accepted but ignored, for compatibility with Unix. Also see section Common options.


Go to the first, previous, next, last section, table of contents.