Special File Types   «Prev  Next»
Lesson 6 Directory listings
Objective Match the ls Command Options to Descriptions of their Purpose.

Match ls Command Options to Descriptions of their Purpose

We have already used the ls command extensively. A number of other useful options to use with ls are listed in the table below:

Option Purpose
-R Generate recursive listing.
-F Label files in listing with /, *, @ for directories, executables, and symbolic links.
-t List files in order of modification time.
-u List files in order of access time.
-g Include information on group of files.
-a Include hidden files.
-l Generate long format listing.

ls Command Options

Click the link below to read about ls command options.
ls Command Options

ls [options] [names]
If no names are given, list the files in the current directory. With one or more names, list files contained in a directory name or that match a file name.
The options let you display a variety of information in different formats. The most useful options include -F, -R, -a, -l, and -s. Some options do not make sense together; e.g., -u and -c. Modern versions of ls pay attention to the LC_COLLATE environment variable. Its default value, en_US, (in the United States) causes ls to sort in dictionary order (i.e., ignoring case). You may prefer to set LC_COLLATE to C to restore the traditional Unix behavior of sorting in ASCII order.

Common Options

Command Purpose
-a, --all List all files, including the normally hidden . files.
-A, --almost-all Like -a, but exclude . and .. (the current and parent directories).
-b, --escape Show nonprinting characters in octal.
-c, --time-ctime, --time=status List files by inode modification time.
-C, --format=vertical List files in columns (the default format, when displaying to a terminal device).