List Files or Directories
Usage: ls [-+][lLoOgG!rqhx- ndtsez mU c DHSARC.a 0-9 FQTw]
pathname1 [ pathname2 ... ]
ls lists the specified files or directories. Directory names are
normally highlighted and names of files or directories with the
system bit set are normally shown in green but you may choose
your own colors if you prefer.
File and directory names are normally reported in the actual mixed
case in which they appear. But ls will look for an environmental
variable, MIXEDCASEDRIVES, giving a list of drives, e.g., f-hq,
meaning only drives F: through H: and drive Q: should displayed
in mixed case with the rest reported in all lower case.
To customize ls with a default behavior of your own choosing, use
the LSOPTIONS environmental variable. ls will first process any
options specified in LSOPTIONS before any specified on the command
line.
Options:
-l Long format listings of the files or directories.
-L Very Long format listings with a more precise timestamp.
-o Owner. List the owner, if known, with each file or
directory. (Ignored under Windows 9x, which does not
support the full Windows security model.)
-O Like -o, but enables polling of other Windows NT machines
on the network if a user or group ID is not known locally.
(But be aware that polling can take several seconds.)
-g Group. List the group, if known, with each file or
directory. (Ignored under Windows 9x, which does not
support the full Windows security model.)
-G Like -g, but enables polling of other Windows NT machines
on the network if a user or group ID is not known locally.
-! List just the names specified, not the contents of any
directories. (Remember to type this option at the end of
the list so the space afterward will prevent it being
confused as a history reference.)
-r Recursively list contents of any subdirectories.
-q Quiet. Don't generate an error message for non-existent
files.
-h Help (short list.)
-hx Extended help (this screen.)
-- End of options. (Useful if filenames start with "-".)
Sorting Options:
Sorts may be done in any order; default is -nds. (The filename is the
most important sort criteria and ties are broken by date or size.)
-n Name (lowest alphabetic first.)
-d Date (oldest first.)
-t Time (same as -dz = newest first.)
-s Size (largest first.)
-e Extension (lowest alphabetic first.)
-z Reverse the major or last specified sort.
-m Merge the listings of directories and files.
-U Unordered (in order of appearance in the directory.)
Selection Criteria:
+<type> Include files/directories fitting this pattern.
-<type> Leave out anything fitting this pattern.
where <type> is a combination of the following characters:
D Directories.
H Hidden files or directories.
S System files or directories.
A Archive bit set.
R Read-only files or directories.
C Compressed files or directories. (Supported only under
Windows NT 3.51 or later.)
. "." and ".." files.
or the single char:
a All files or directories regardless of attributes.
The default is "+a -. -H", meaning anything other than "." and ".." not
marked Hidden. Anything specified is added to/subtracted from this
set. Ordering of additions/substractions does make a difference.
If the slash, "/", is used to introduce options, it is treated
as a plus when used with selection criteria.
Selection criteria normally applies only to directories and files
found by listing a directory. All names given on the command line
will be listed if they exist regardless of whether they match the
selection criteria unless the -c option is specified.
-c Command line names must match criteria also, unless only one
name is given.
Listing Options:
-<integer> Specified number of columns.
-0 Standard multi-columns on 80-column screen.
-F Put a backslash (or a slash, if the escape character is the
backslash) after each directory name.
-Q Quote any filenames containing special characters that might
be misinterpreted by the C shell in command substitution.
-T True mixed-case. Display filenames in the upper- or lower-
case characters actually stored in the file system.
-w Walk subdirectories to show true sizes in long format listings.
Colors:
You may set your own choices for screen colors using these
environmental variables:
Name Use Default
COLORS Normal screen colors <null string>
READONLYFILES Files marked read-only same as COLORS
SYSTEMFILES Files with system bit set Green
DIRECTORIES Directories Bright
READONLYDIRS Directories marked read-only same as DIRECTORIES
SYSTEMDIRS Directories with system bit set (see below)
Colors recognized are black, red, green, yellow, blue, magenta
(or red blue), cyan (or blue green) or white. Foreground and
background colors may also be bright, dim or reverse. The names
of the colors and the words bright, dim, reverse and on may be in
either upper or lower or mixed case.
Either or both the foreground and background colors may be
specified; if you don't specify a value, it's considered
transparent and inherits the color underneath it. SYSTEMDIRS
normally inherits a merging of the DIRECTORIES and SYSTEMFILES
colors. DIRECTORIES and SYSTEMFILES inherit from COLORS. If
a file or directory has both the system and read-only bits set,
the system colors will be used. If COLORS is null, ls uses
the current screen colors it finds at startup. Specifying
COLORS=none turns off all use of color.
|