SYNOPSIS
ls [-abcCdfFgHilLmnopqrRstux1hSUX] [file ...]
lc [-abcCdfFgHilLmnopqrRstux1hSUX] [file ...]
DESCRIPTION
For each directory argument, ls lists the contents of the directory;
for each file argument, ls repeats its name and any other information
requested. The output is sorted alphabetically by default. When no
argument is given, the current directory is listed. When several argu-
ments are given, the arguments are first sorted appropriately, but file
arguments appear before directories and their contents. There are sev-
eral options:
-a List all entries; usually files that begin with a `.' are sup-
pressed.
-b Non-printable characters are printed as octal numbers `\ddd'.
-c Use time of last modification to inode (mode, etc.) instead of
last modification to file for sorting (-t) or printing (-l).
-C Output is printed in multiple columns, sorted down the columns.
This format is selected by default if standard output refers to
a terminal, or if the command is invoked as lc.
-d If argument is a directory, list only its name, not its contents
(mostly used with -l to get status on directory).
-f Force each argument to be interpreted as a directory and list
the name found in each slot. This option turns off -l, -t, -s,
and -r, and turns on -a; the order is the order in which entries
appear in the directory.
-F Indicates the file type as a letter appended to each pathname:
lfB l. / directory * executable file @ symbolic link
| named pipe = socket > Solaris door
Symbolic links specified as arguments are not followed with this
option in /usr/5bin/posix2001/ls unless the -H or -L option is
also present.
-g Give group ID, but omit owner ID in long listing (see -l).
-i Print i-number in first column of the report for each file
listed.
-l List in long format, giving mode, number of links, owner, group,
size in bytes, and time of last modification for each file.
(See below.) If the file is a special file the size field will
instead contain the major and minor device numbers. Symbolic
-p Print a slash `/' after each directory name.
-q Non-printable characters are printed as question marks `?'.
This is the default if standard output refers to a terminal.
-r Reverse the order of sort to get reverse alphabetic or oldest
first as appropriate.
-R Lists subdirectories recursively.
-s Give size in blocks, including indirect blocks, for each entry.
-t Sort by time modified (latest first) instead of by name, as is
normal.
-u Use time of last access instead of last modification for sorting
(-t) or printing (-l).
-x Prints filenames in multiple columns sorted across the page.
-1 Print one filename per output line. This is the default if
standard output does not refer to a terminal.
The following option was introduced with POSIX.1-2001:
-H Follow symbolic links given as arguments.
The following options are available as extensions:
-h Print file sizes in human-readable powers of 1024, i.e. `K' for
kilobyte, `M' for megabyte, `G' for gigabyte, `T' for terabyte,
`P' for petabyte, and `E' for exabyte.
-S Sort by file size.
-U Do not sort at all.
-X Sort by file name extension, i.e. by the component of the file
name following the last dot.
The mode printed under the -l, -g, and -o options contains 10 charac-
ters which are interpreted as follows: the first character is
lfB l. d if the entry is a directory; b if the entry is a block-
type special file; c if the entry is a character-type special file;
p if the entry is a named pipe; l if the entry is a symbolic
link; S if the entry is a socket; s if the entry is a XENIX sema-
phore; m if the entry is a XENIX shared data (memory) file; D if
the entry is a Solaris door; n if the entry is a HP-UX network spe-
cial file; - if the entry is a plain file.
lfB lw(45n). s if the file has set-group-ID mode; l T{ if manda-
tory locking is enabled for the file (with /usr/5bin/ls and
/usr/5bin/s42/ls); T} L T{ if mandatory locking is enabled for the
file (with /usr/5bin/posix/ls and /usr/5bin/posix2001/ls). T}
Likewise the user-execute permission character is given as
lfB lw(45n). s if the file has set-user-ID mode; S T{ if the
set-user-ID bit is set on the file but it is not executable. T}
The last character of the mode (normally `x' or `-') is
lfB lw(45n). t if the sticky bit of the mode is on; T if the
sticky bit is on but the file is not executable.
See chmod(1) for the meaning of this mode.
When the sizes of the files in a directory are listed, a total count of
blocks, including indirect blocks is printed.
If ls writes its output to a terminal that supports colors or boldface,
file names printed are colorized according to their types:
lfB lw(45n). blue/bold if the file is a directory; yellow/bold if
the file is a special file; yellow if the file is a named pipe;
cyan if the file is a symbolic link; magenta/bold if the file is a
socket or a Solaris door; magenta T{ if the file is a XENIX special
file or a HP-UX network special file; T} green/bold if the file is
executable.
For lc, colors are enabled even if the output is not written to a ter-
minal. This is mainly useful if the output is filtered through a pager
which handles colors, such as pg(1).
FILES
/etc/passwd
to get user IDs.
/etc/group
to get group IDs.
ENVIRONMENT VARIABLES
COLUMNS
Overrides the auto-detected terminal width.
LANG, LC_ALL
See locale(7).
TERM Used to determine the terminal type.
SEE ALSO
chmod(1), locale(7)
Heirloom Toolchest 2/24/05 LS(1)
Man(1) output converted with
man2html