LI, DI(1,C) AIX Commands Reference LI, DI(1,C)
-------------------------------------------------------------------------------
li, di
PURPOSE
Lists the contents of a directory.
SYNTAX
+-- -Oabcdfpx --+ +---------------- -R1 ----------------+
li ---| 1 +-----+ |---| +--- -R ---+ +--------+ +-----+ |--->
+- -O --| a f |-+ +-| |---| one of |---| |-+
^ | b p || +- -R num -+ | +---+ | +- q -+
| | c x || +-| a |--+
| | d || | p |
| +-----+| +---+
+--------+
+--------- -Sn ---------+ +----------------+ +------- -In -------+
>---| +- -S --+ +-------+ |---| +------------+ |---| +----+ 1 +-----+ |--->
+-| |---| a n x |-+ +-| -a -n -x |-+ +-| -I |---| a m |--+
+- -Sr -+ ^ | c s || ^| -d -s -l || ^| -E | ^ | c n |||
| | m u || || -f -v -num || |+----+ | | o p |||
| +-------+| || -k || | | | g h |||
+----------+ |+------------+| | | | i s |||
+--------------+ | | | l u |||
| | +-----+||
| +--------+|
+-----------------+
+------ . ------+
>---| +-----------+ |---|
+-| file |-+
^| directory ||
|+-----------+|
+-------------+
+------ . ------+
di ---| +-----------+ |---|
+-| file |-+
| directory |
+-----------+
----------------
1 Do not put a blank between these items.
DESCRIPTION
Processed November 8, 1990 LI, DI(1,C) 1
LI, DI(1,C) AIX Commands Reference LI, DI(1,C)
The li command lists the contents of each named directory or archive file on
standard output. For each non-archived file named, the li command displays the
file name and any information requested. If you do not specify a file or
directory, the li command lists the current directory.
By default, the li command sorts the output alphabetically and lists it in
multiple columns. The collating sequence is determined by the LANG and
LC_COLLATE environment variables. It displays control characters in file names
in expanded form (for example, "^D", "\177", and so on). When you specify more
than one file or directory, the li command sorts them appropriately, but files
are listed before directories and their contents. When the date and time
appear, the LANG and LC_TIME environment variables control their format.
The di command is equivalent to li -Ialmops.
If a file is a symbolic link, the li command lists the file name, followed by
the string "->" and then the contents of the symbolic link. If a file is a
hidden directory, the li command lists the directory name, followed by the
string "@/" and then the name of the matched hidden directory component.
Permissions Field
The permissions field is displayed with the -Ip flag. This field contains 11
characters. The first character can be one of the following:
d The entry is a directory.
b The entry is a block-type special file.
c The entry is a character-type special file.
h The entry is a hidden directory, and either the file argument was escaped
with a trailing "@" or there was not a component that could be matched in
a hidden directory.
l The entry is a symbolic link, and the symbolic link did not point to an
existing file.
p The entry is a pipe (FIFO).
- The entry is an ordinary file.
The next nine characters are interpreted as three sets of three bits each. The
first set refers to owner permissions, the next set to permissions for others
in the same group, and the last set to all others. Each of the three
characters within each set indicates, respectively, permission to read, write,
or execute the file. For a directory, execute permission is interpreted as
permission to search the directory for a file. These permissions are indicated
as follows:
r The file is readable.
w The file is writable.
x The file is executable.
- The corresponding permission is not granted.
The group-execute permission is given as s if the file has set-group-ID mode.
The user-execute permission character is given as s if the file has set-user-ID
mode. (For a discussion of these modes, see "chmod.")
Processed November 8, 1990 LI, DI(1,C) 2
LI, DI(1,C) AIX Commands Reference LI, DI(1,C)
The last character of the field is usually blank, but a t is displayed if bit
1000 of the mode is on. (See the chmod system call in AIX Operating System
Technical Reference for the current meaning of this mode.)
Note: Some combinations of flags do not work well together. For example, "li
-vRa" looks unusual, and "li -RSx" and "li -Sx *" are both nearly
unintelligible if there are subdirectories contained in the current
directory, due to confusion about what level is being listed.
FLAGS
Flags are grouped into five classes: fields (the I or E flag), restrictions
(the O flag), recursion (the R flag), sort orders (the S flag), and
miscellaneous. The following flags modify the action of li:
-I [hiplogcsmaun]
-E [hiplogcsmaun]
Requests the inclusion (-I) or exclusion (the -E) of certain fields. These
fields are selected by the flags in the subset hiplogcsmaun.
-I This flag includes the selected fields in the order in which they appear in
the argument list; the -E flag excludes these fields. For example,
"-l -Ep" excludes the protections (P) field, while "-Ep -l" includes it,
since "-l" (the equivalent of "-Icglmop") follows "-Ep".
The only field included by default is the name (n) field. If you include
any other fields, li lists the output in single-column rather than
multiple-column format. The li command lists the following fields in the
following order:
h Headers
i I-number
p Protections
l Link count
o Owner (name or UID)
g Group (name or GID)
c Character count
s Size in blocks
m Modified time
a Accessed time
u Updated (inode modified) time
n Name
If the file is a special file, the size (s) field contains the major and minor
device numbers. If you select the c (character count) or s (size in blocks)
flags, the li command writes the total number of blocks for each directory and
the grand total when appropriate.
-O [abcdfpx]
Requests that the listing be restricted to files of certain types. These
types are selected from the subset abcdfpx. The possible types are:
Processed November 8, 1990 LI, DI(1,C) 3
LI, DI(1,C) AIX Commands Reference LI, DI(1,C)
a Archives
b Block devices
c Character devices
d Directories
f Files (normal, not special)
p Pipes (FIFOs)
x Executable files (any file with execute permission)
-R[num]apq
Lists recursively to num levels deep. The default depth is infinite. This
flag normally displays a single column, with a two-column indentation for
each level of the directory structure. When the li command reaches a
directory with no subdirectories, it lists the contents of that directory
in multiple-column form. Specifying either -Ra or -Rp suppresses the
indentation and multiple-column display. These flags display either the
full (-Ra) or relative (-Rp) path names of each file found. The Rq flag
also lists the contents of archive files. (See the archive file format in
AIX Operating System Technical Reference.)
li command
Reaches a directory with no subdirectories, it lists the contents of that
directory in multiple-column form. Specifying either -Ra or -Rp suppresses
the indentation and multiple-column display. These flags display either
the full (-Ra) or relative (-Rp) path names of each file found. The -Rq
flag also lists the contents of archive files. (See the archive file
format in AIX Operating System Technical Reference.)
-S [acmnrsux]
Describes the order in which the listing is to be displayed. The default
order is by name (n). The -Sx flag specifies no sorting. Choosing a flag
from the subset acmnsu selects which of the following fields, the listing
is sorted by.
a Accessed time, latest first
c Character count, largest first
m Modified time, latest first
n Name
s Size (same as character count)
u Updated time, latest first
If you include the r flag with any of these flags, the li command reverses the
order of the sort.
The miscellaneous flags are:
-a Lists all entries, including those beginning with . (dot).
-d Lists only the name, not the contents, of directories.
Processed November 8, 1990 LI, DI(1,C) 4
LI, DI(1,C) AIX Commands Reference LI, DI(1,C)
-f Forces the li command to interpret each file as a directory and to list the
name found in each slot. All flags requiring information not found in
directory entries are turned off and the -a flag is turned on. Names are
listed in the order that they appear in the directory.
-l Uses a listing that is equivalent to "li -Icglmop" (the long form listing).
That is, it lists the permission code, link count, owner, group, character
count, time of last modification, and name of each file.
-n Inhibits the interpretation of control characters in file names. This flag
is useful for generating lists of file names for program input or for
editing into per-file commands.
-s Provides a listing similar to that of the -v flag, except that the
distinguishing marks for file types do not affect sorting (a sortable
verbose list). Subdirectories appear in the listing as name/, files with
execute permission as name* , and special files as name?.
-v Lists files in a way that visually differentiates file types (a verbose
visual listing). With this flag, the li command lists subdirectories as
[name], files with execute permission as <name>, and special files as
*name*. This differentiation occurs before the -S sort. Thus, different
types of files are sorted into different parts of the listing.
-x Displays every available field except headers (an extended form listing).
This is equivalent to specifying "li -Iacglimopsu".
-num
Lists with a maximum of num columns. If num is unreasonable, the li
command picks its own num. This flag can be used as in "li -1" to make
shell files or in "li-Io9" to force the li command to display its output in
multiple columns. A number appearing in any flag argument is assumed to be
the number of columns unless it follows the -R flag.
EXAMPLES
1. To list the files in the current directory in alphabetical order:
li
2. To list all files in the current directory, including those with names
beginning with a "." (dot):
li -a
3. To display detailed information:
li -l chap1 .profile
This command displays a long listing with detailed information about
"chap1" and .profile. It lists all the information that you probably need
Processed November 8, 1990 LI, DI(1,C) 5
LI, DI(1,C) AIX Commands Reference LI, DI(1,C)
to see. However, the li command can supply even more information with the
-x flag.
4. To display detailed information about a directory:
li -d -l . manual manual/chap1
This command displays a long listing for the directories "." and "manual",
and for the file "manual/chap1". Without the -d flag, this command would
list the files in "." and "manual" instead of the detailed information
about the directories themselves.
5. To list the files in order of modification time:
li -Sm -l
This command displays a long listing of the files that were modified most
recently, followed by the older files.
6. To include extra information in the listing:
li -Ichil
In addition to the file name, this command lists the character count (-Ic),
i-number (-Ii), and link count (-Il) for each file in the current
directory. The -Ih flag tells the li command to write a heading at the top
of each column of information.
7. To list the contents of each directory in a tree:
li -R manual
This command lists the names in each subdirectory of the tree that starts
with "manual".
FILES
/etc/passwd Contains user names for li -Io.
/etc/group Contains group names for li -Ig.
RELATED INFORMATION
See the following commands: "ls, lf, lr."
See the chmod system call and the environment miscellaneous facility in AIX
Operating System Technical Reference.
See "Introduction to International Character Support" in Managing the AIX
Operating System.
Processed November 8, 1990 LI, DI(1,C) 6