HP-UX Reference (11i v3 07/02) - 1 User Commands A-M (vol 1)
l
ls(1) ls(1)
NAME
ls, lc, l, ll, lsf, lsr, lsx - list contents of directories
SYNOPSIS
ls [-abcdefgilmnopqrstuxACFHLR1
][names]
lc [-abcdefgilmnopqrstuxACFHLR1
][names]
l [ls_options][names]
ll [ls_options][names]
lsf [ls_options][names]
lsr [ls_options][names]
lsx [ls_options][names]
DESCRIPTION
For each directory argument, the
ls command lists the contents of the directory. For each file argument,
ls repeats its name and any other information requested. The output is sorted in ascending collation order
by default (see Environment Variables below). When no argument is given, the current directory is listed.
When several arguments are given, the arguments are first sorted appropriately, but file arguments appear
before directories and their contents.
If you are a user with appropriate privileges, all files except . and .. are listed by default.
There are three major listing formats. The format chosen depends on whether the output is going to a
login device (determined by whether output device file is a
tty device), and can also be controlled by option
flags.
The default format for a login device is to list the contents of directories in multicolumn format, with
entries sorted vertically by column. (When individual file names (as opposed to directory names) appear in
the argument list, those file names are always sorted across the page rather than down the page in columns
because individual file names can be arbitrarily long.) If the standard output is not a login device, the
default format is to list one entry per line.
The -C and -x options enable multicolumn formats, and the -m option enables stream output format in
which files are listed across the page, separated by commas. In order to determine output formats for the
-C, -x, and -m options, ls uses an environment variable, COLUMNS, to determine the number of charac-
ter positions available on each output line. If this variable is not set, the
terminfo database is used to
determine the number of columns, based on the environment variable
TERM. If this information cannot be
obtained, 80 columns is assumed.
The command lc functions the same as ls except that the lc default output is columnar, even if output is
redirected.
Options
ls recognizes the following options:
-a List all entries; usually entries whose names begin with a period (.) are not listed.
-b List nonprinting characters in the octal \ddd notation.
-c Use time of last modification of the inode (file created, mode changed, etc.) for sorting (-t)or
printing (-l (ell)).
-d If an argument is a directory, list only its name (not its contents); often used with -l (ell) to get
the status of a directory.
Under the UNIX 2003 environment (see standards(5)), ls with -d does not follow symbolic
links unless the -H or -L option is specified.
-e List the extent attributes of the file. If any of the files has a extent attribute, this option lists the
extent size, space reserved and allocation flags. This option must be used with the -l (ell)
option.
-f Interpret each argument as a directory and list the name found in each slot. This option disables
-l (ell), -r, -s, and -t, and enables -a; the order is the order in which entries appear in the
directory.
-g Same as -l (ell), except that only the group is printed (owner is omitted). If both -l (ell) and
-g are specified, the owner is not printed.
606 Hewlett-Packard Company − 1 − HP-UX 11i Version 3: February 2007