Flags

The following (case-sensitive) flag characters are supported:

-f Lists all ordinary (including read-only) files that match the file specification(s). If the -f flag is specified, then directories are not listed unless the -d flag is also specified.

-s Lists all system files.

-h Lists all hidden files.

-d Lists all subdirectories that match the file specification(s). If the -d flag is specified, then ordinary files are not listed unless the -f flag is also specified.

-a Lists all ordinary files, system files, hidden files, directories, the . and .. directories, and, for DOS only, volume IDs.

-l Lists each matching file or directory name in ``long'' format. For each name, it also displays the attributes, size, time stamp, and date stamp. If -l is not specified, the ls command lists only the names.

-c Uses time of creation instead of time of last modification. If used with -l, it shows this time. If used with -t, it sorts using this time. (Win32 and OS/2 versions only.)

-u Uses time of last access instead of time of last modification. If used with -l, it shows this time. If used with -t, it sorts using this time (NTFS and HPFS only).

-x The same as -u, for compatibility with previous versions of ls.

-R Recursively descends subdirectories.

-p Puts a path separator after each name that is a directory.

-C Forces multicolumn output. The ls command tries to list more than one filename per line, depending upon the length of the longest name and the width of the display screen. Filenames are sorted vertically.

-m The same as -C, for compatibility with previous versions of ls.

-1 Forces single (one) column output.

-n Sorts the output by name (default), in alphabetic order.

-t Sorts the output by date and time, from newest to oldest.

-z Sorts the output by filesize, from smallest to largest.

-r Reverses the order of the sort.

-o Don't sort: display filenames in the order in which they occur in each directory.

-g Lists each set of matching files as a group in the order that their fspecs are specified. For example, if *.h *.c are entered, then the -g flag causes all .h files to be displayed first and all .c files to be displayed next.

The -g flag causes the program to make a separate pass through a directory for each fspec, making 'ls' run slower. The default behavior is to display all matching files as they are found, making only one pass through each directory.

-L Shows filenames in lowercase.

-U Shows filenames in uppercase.

You can mix and match the f, s, h, and d flags to include as many different file types as you wish. If you specify at least one of the s, h, or d flags, then you must explicitly specify -f to include ordinary files in the listing. If you don't specify one of the f, s, h, d, or a flags, then the default is -fd: list only ordinary files and directories.

You can specify the -l (letter el) flag to list file and/or directory names in ``long'' format. In this format, each name appears along with its mode, size, date, and time. The mode (attribute) consists of a set of characters that are interpreted as follows: