li
PURPOSE
Lists the contents of a directory.
SYNOPSIS
li [ -Ihiplogcsmaun ] [ -Ehiplogcsmaun ] [ -Oabcdfpx ] [ -R[number]apq ]
[ -Sracmnsux ] [ -number ] [ -adflpvx ] [ files ]
di [ files ]
DESCRIPTION
The li command lists the contents of each named directory
or archive file on standard output. For each nonarchive
file named, li displays the file name and any information
requested. If you do not specify a file or directory, li
lists the current directory.
By default, li sorts the output alphabetically and lists
it in multiple columns. The collating sequence is deter-
mined by the NLCTAB environment variable (see "ctab").
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, li sorts them
appropriately, but files appear before directories and
their contents. When the date and time appear, the
NLLDATE and NLTIME environment variables control their
format. The NLSMONTH environment variable controls the
short names for months.
The di command is equivalent to "li -Ialmops".
Permissions Field
The permissions field displayed with the -Ip flag con-
tains 11 characters. The first character is:
d The entry is a directory.
b The entry is a block-type special file.
c The entry is a character-type special file.
p The entry is a pipe (FIFO).
- The entry is an ordinary file.
D The entry is a remote directory.
F The entry is a remote ordinary file.
B The entry is a remote block special file.
C The entry is a remote character special file.
P The entry is a remote first-in first-out (FIFO)
special file.
The next nine characters are interpreted as three sets of
three bits each. The first set refers to owner permis-
sions, the next to permissions for others in the same
group, and the last to all others. Each of the three
characters within each set indicate, respectively, per-
mission to read, write, or execute the file. For a
directory, "execute" permission is interpreted as permis-
sion to search the directory for a special file. These
permissions are indicated as follows:
r If the file is readable.
w If the file is writable.
x If the file is executable.
- If 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 char-
acter is given as s if the file has set-user-ID mode.
(For a discussion of these modes, see "chmod.")
The last character of the field is normally blank, but is
displayed as t if the 1000 bit 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 direc-
tory, due to confusion about what level is being listed.
FLAGS
Flags are grouped into five classes, four of which are
always introduced by an uppercase letter: fields (I or
E), restrictions (O), recursion (R), sort orders (S), and
miscellaneous. The following flags modify the action of
li:
-I [hiplogcsmaunrfb]
-E [hiplogcsmaunrfb]
Requests the inclusion (-I) or exclusion (-E) of
certain fields. These fields are selected by the
flags in the subset hiplogcsmaunrfb. -I includes
and -E excludes the selected fields in the order in
which they appear in the argument list. For
example, "-l -Ep" excludes the protections field,
while "-Ep -l" includes it, since "-l" (the equiv-
alent 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. li lists the following fields in
the following order:
h Headers
i I-number
p Protections
l Link count
o Local owner (name or UID)
g Local group (name or GID)
c Character count
s Size in blocks
m Modified time
a Accessed time
u Updated (i-node modified) time
n Name
r Node where the entry resides
f Raw UID of the entry's owner
b Raw GID of the entry's group.
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, li writes a total number of blocks
for each directory and a grand total when appro-
priate.
For remote files and directories, the local owner
and local group are obtained by using inverse IDs.
If there is no inverse ID or if li cannot determine
the inverse ID, a - (minus sign) displays in the
corresponding field. If possible, remote nodes are
identified with nicknames. Otherwise, they are
identified by their NID displayed in hexadecimal.
(See "Distributed Services Concepts" in Managing
the AIX Operating System.)
For local files and directories that do not have a
nickname defined for the local node ID, the node ID
field displays as a - (minus sign), and the raw UID
(GID) field contains the local owner UID (group
GID).
-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:
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 per-
mission)
-R[num]apq
Lists recursively to num levels deep. The default
depth is infinite. This normally displays a single
column, with a two-column indentation for each
level of the directory structure. When li reaches
a directory with no subdirectories, it lists the
contents of that directory in multiple-column form.
Specifying either -Ra or -Rp suppresses the inden-
tation 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.
When using the -Rq flag to list the contents of
remote archive files, the user and group fields
display as a - (minus sign) unless the -k flag is
specified. With the -k flag, the user and group
fields for archive entries display as raw as found
in the archive. (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 field the
listing will be 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, li
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 directo-
ries.
-f Forces li 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.
-k Provides a listing that is equivalent to "li
-Ibcfmpr". That is, it lists the permission code,
node ID, remote UID, remote GID, time of last mod-
ification, character count, and file name for
remote entries.
-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, char-
acter count, time of last modification, time of
last access, 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, li 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 -Iabcfglimoprsu".
-num Lists with a maximum of num columns. If num is
unreasonable, li picks its own num. This flag can
be used as in "li -1" to make shell files or
"li-Io9" to force li to display its output in mul-
tiple 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 alpha-
betical 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 displays a long listing with detailed informa-
tion about "chap1" and .profile. It lists all the
information that you probably need to see. However,
li can supply even more information with the -x flag.
4. To display detailed information about a directory:
li -d -l . manual manual/chap1
This displays a long listing for the directories "."
and "manual", and for the file "manual/chap1". -d
flag, this would list the files in "." and "manual"
instead of the detailed information about the direc-
tories themselves.
5. To list the files in order of modification time:
li -Sm -l
This 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 lists the char-
acter count (-Ic), i-number (-Ii), and link count
(-Il) for each file in the current directory. The
-Ih tells li 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 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
The following commands: "ctab" and "ls."
The chmod system call and the environment miscellaneous
facility in AIX Operating System Technical Reference.
"Overview of International Character Support" in Managing
the AIX Operating System.
"Distributed Services Concepts" in Managing the AIX Oper-
ating System.