Contents of the LS.DOC file
ls - a Unix-like directory listing program for MS-DOS
Syntax: ls [-acilrstuR] [(path)name ... ]
Options may appear in any order, grouped or separated; if separate,
each must be preceded by a dash. The name(s) may refer to files or
directories. If no name is given the current directory is listed.
(none) Show filenames (only) sorted alphabetically
-a all: include system files, hidden files, "." and ".."
-c columnar: list information in 1-column format
-i don't identify directories
-l long listing: include file's size, date, time, attributes
-r reverse the sorting direction
-s report size(s) only
-t sort by time of last file modification
-u include actual disk use, with totals & available space
-R recursively list all subdirectories
With no options specified, "ls" lists the filenames in the current directory,
sorted alphabetically into 5 columns; if a (path)name of a directory is
included, its contents will be displayed. If two or more names are given
they will be sorted and shown successively, identified by their (path)names.
Wild card characters ("*","?") are acceptable in (path)name arguments.
Pathnames can be separated by either "/" or "\", whichever you normally use.
Subdirectories are identified by a trailing pathname-separator character
in this display format.
System files, "hidden" files and the directory synonyms "." and ".." are
normally not included in the listing, but the -a option will bring them out
of the woodwork. "Volume Labels" are always ignored. If they have any
logic or value it has been carefully hidden by Microsoft.
The listed filenames will be sorted according to their last modification time
if the -t option is included, normally latest first. The direction of sort
(alphabetic or time sort) is reversed by the -r option.
The -l option yields a two-column "long" listing, sorted vertically by column,
showing nearly everything known about the files (i.e. all the news that fits).
The file attributes are shown symbolically by single characters: "d" for
directories or "s" for system files, "h" for hidden files, and "w" for writable
(not read-only) files. The lack of one of these attributes is shown by a dash.
The actual length of the file, in bytes, is given unless the -u option is
included (see below). The month and time of the last modification are shown if
the file is less than 12 months old, otherwise month and year are printed.
Note that the file sizes displayed in the "long" listing will always be
smaller than the actual disk space used, because MS-DOS never writes a record
smaller than the "cluster" size -- which is 1024 bytes on a 9-sector floppy
and 4096 bytes on a 10 MB hard disk (8192 for 20MB) for DOS 2.x. DOS 3.x is
somewhat more reasonable about disk use.
The -u option tells you how much disk space is actually used. If only one
filename or directory is listed, its total disk use is shown, followed by
its identifying (path)name. If the -l option is included with -u, the size
shown for each file is the amount of disk space used -- almost always larger
than the file size. More than one name on the command line will get you
successive listings, with disk use subtotals preceding the identifying
(path)name, and followed by the total disk space used by the files listed.
All this is followed by the space remaining on the drive; if more than one
drive is involved, it is the space remaining on the last one on the command
The first line of a printed block shows the drive and the absolute path to the
directory, with filenames on the following lines, ending with a blank line.
You can suppress the directory pathname with the -i option, should you want to
use the list of filenames in a .bat file or another program, for example.
The -c option forces output into a single column, so "ls -ic" will give a
sorted list of filenames in a single column, with the directory pathname
suppressed; "ls -lc" will provide a "long" listing in one column instead of
two, with the pathname shown.
The -R option will include (recursively) the contents of any subdirectories
encounterd, and their subdirectories, ad finitum. This can be a lengthy
listing on a hard disk; if started in the root directory with the -a option
it lists the whole shebang.
The -s option omits filenames (unless they are specified on the command line)
and lists sizes only. This effectively shuts off the -l, -t and -r options,
and turns -u on, yielding a nifty summary of disk usage by directory, along
with a total at the end and the space remaining on the drive. Include -a if
you want hidden and system files to show up.
As a special case, the -s option recognizes the numerals "1" and "2" (they
must immediately follow the "s" option) and will use disk block sizes
appropriate to single-sided diskettes (-s1) or double-sided diskettes (-s2)
in the calculatation of actual disk usage. This is useful if you want to
know if a given set of files is going to fit on a diskette that uses block
sizes different from those on the source disk. For example, MS-DOS is far
more profligate with disk space on a hard disk than on a floppy, and disk
use appears to "shrink" onto a floppy backup. These options can tell you
how much shrinkage to expect.
The program includes a built-in pager which stops scrolling after 22 lines
have been displayed on your terminal, and indicates there is more to be
shown if there really is. A carriage return shows one more line; any other
character gets another screenful. This action takes place only if the
output device is your console screen -- the pause will not occur if the
output is redirected to any other device or into a file. Either "q" or
"ctrl-C" will force exit without further output.
The options are far from being mutually orthogonal; in particular, the
command "ls -u filename", for a single file that is not a directory, gives
a dumb-looking printout.