ls


ls

Purpose

List the contents of a directory.

Syntax

ls [options] [directory_name]

Options

-a displays all files, including those that start with a period (.).

-b displays unprintable characters in filenames with octal code.

-c sorts according to file creation time.

-d lists directories like any other file (rather than listing their contents).

-f lists directory contents without sorting (exactly as they are in the disk).

-i shows the inode information.

-l shows the file listing in the long format, with detailed information.

-p appends a character to a filename to indicate its type.

-r sorts the listing in reverse alphabetical order.

-s shows the size (in kilobytes) of each file next to the filename.

-t sorts the listing according to the file's time stamp.

-1 displays a one-column listing of filenames.

-R recursively lists the files in all subdirectories.

Description

The ls command displays the listing of a specified directory. If you omit the directory name, ls displays the contents of the current directory. By default, ls does not list files whose names begin with a period (.); to see all files, type ls -a. You can see full details of files (including size, user and group ownership, and read-write-execute permissions) with the ls -l command.