HP-UX Reference (11i v2 03/08) - 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 [-abcdefgilmnopqrstuxACFLR1
][names]
lc [-abcdefgilmnopqrstuxACFLR1
][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 argu-
ments 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 for-
mat, 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 character positions available on each out-
put 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.
-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 dis-
ables -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.
-i For each file, list the inode number in the first column of the report. When used in mul-
ticolumn output, the number precedes the file name in each column.
-l (ell) List in long format, giving mode, number of links, owner, group, size in bytes, and time of
last modification for each file (see further DESCRIPTION and Access Control Lists below). If
the time of last modification is greater than six months ago, or any time in the future, the year
is substituted for the hour and minute of the modification time. If the file is a special file, the
HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 1−−489