Lists the contents of a directory.
li [ -I [ abcfghilmnoprsu ] ] [ -E [ abcfghilmnoprsu ] ] [ -O [ abcdfpx ] ] [ -S [ acmnrsux ] ] [ -R [ Number ] [ anqp ] ] [ -Number ] [ -a ] [ -d ] [ -e ] [ -f ] [ -l ] [ -n ] [ -s ] [ -v ] [ -x ] [ -L ] [ File ... ] [ Directory ... ]
di [ File ... ] [ Directory ... ]
The li command lists information about each named File and the files in each named Directory. If File is an archived file and the -R flag is specified, the li command lists the files in the archive.
The li command lists regular files before directories, with file and directory names listed in collation order. Non-printable characters in file names are displayed in expanded form (for example, ^ D, \177). The collation order of file names and the format of dates and times are determined by the current National Language environment. See the "National Language Support Overview for System Management" in AIX Version 4.3 System Management Guide: Operating System and Devices for details.
The li and di commands use 512-byte blocks when reporting physical disk space allocated for the file. Physical disk space is assigned in increments of 4096 bytes (8X512).
The di command is equivalent to the li command with the optional -I flag and almops variables.
The permissions field displayed with the -lp flag contains 11 characters. The permissions field displayed with the -e flag contains 12 characters. The first character in either case is one of the following:
|b||Block type special file|
|c||Character type special file|
|p||Pipe first-in-first-out (FIFO)|
|B||Remote block special file|
|C||Remote character special file|
|F||Remote ordinary file|
|L||Remote symbolic link|
|P||Remote (FIFO) special file|
The next nine characters are interpreted as three sets of 3 characters each. The first set refers to owner permissions, the second to permissions for others in the same group, and the third to permissions for all others. Each of the three characters within each set indicate, respectively, permission to read, write, or execute the file. For a directory, execute permission is interpreted as permission to search the directory for a specified file. These permissions are indicated as follows:
|-||Corresponding permission not granted|
The group-execute permission is given as an s if the file has set-group-ID mode. The user-execute permission character is given as an s if the file has set-user-ID mode.
The 11th character of the field is normally empty, but is displayed as a t if the file is either a directory with link permission or a regular file with the save text attribute.
The mode displayed with the -e flag is the same as that displayed with the -l flag, except for the addition of a 12th character interpreted as follows:
|+||Indicates a file with extended security information. For example, the file may have extended ACL, TCB, or TP attributes in the mode.|
|-||Indicates a file does not have extended security information.|
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 the li command:
|-I[hiplogcsmaunrfb] or -E[hiplogcsmaunrfb]|
| Requests the inclusion (-I) or exclusion (-E) of certain fields. The fields are selected by the flags from the hiplogcsmaunrfb subset. The -I flag includes, and the -E flag excludes, the selected fields in the order in which they are displayed in the option list. For example, -l -Ep excludes the protections 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, the li command lists the output in single-column rather than multiple-column format. The li command lists the following fields in the following order:
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) flag, the li command writes a total number of blocks for each directory and a grand total when appropriate.
|-O[abcdfpx]|| Requests that the listing be restricted to files of certain types. These types are selected from the abcdfpx subset. The possible types are:
|-R[Number]anpq|| Lists recursively to the specified number of 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 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. When using the -Rq flag to list the contents of remote archive files, the user and group fields display as a - (minus sign).
|-S[acmnrsux ]|| Describes the order in which the listing is displayed. The default order is by name (n). Choosing a flag from the acmnsu subset selects which field the listing is sorted by:
The other flags are:
|-a||Lists all entries, including those beginning with . (dot).|
|-d||Lists only the name, not the contents, of directories.|
|-e||Displays the mode (including security information), number of links, owner, group, size (in bytes), time of last modification, and name of each file.|
|-f||Forces the li command to interpret each File parameter specified 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 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.|
|-L|| Follows a symbolic link and reports on the file at the end of the link. If the file at the end of the link does not exist, the li command reports on the symbolic link itself.
|-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*, special files as Name?, and symbolic links 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>, special files as *name*, and symbolic links 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.|
|-Number||Lists with a specified maximum number of columns. If the value of the Number variable is unreasonable, the li command picks its own value. 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 option is assumed to be the number of columns, unless it follows the -R flag.|
li -l chap1 .profileThis displays a long listing with detailed information about chap1 and the .profile file. It lists all information that you need to see. However, the li command can supply even more information with the -x flag.
li -d -l . manual manual/chap1This displays a long listing for the . (dot) and manual directories, and for the manual/chap1 file. directories
li -Sm -lThis displays a long list of the most recently modified files, followed by the older files.
li -IchilIn addition to the file name, this lists the character count (-Ic), i-node 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.
li -R manualThis lists the names in each subdirectory of the tree that starts with manual.
li -lIsSsThis command displays the contents in the sample directory as:
-rw-r--r-- 1 jack acct 13982 28B Jan 26 11:23 yearly Frw-r--r-- 1 jack acct 395 8B Apr 01 09:30 mayacct Frw-r--r-- 1 jack acct 17 8B May 10 10:19 maycorr Frw-r--r-- 1 jack acct 4092 8B June 06 12:29 mayfinBecause the s flag sorts the files according to the number of physical blocks allocated, the files in the directory do not necessarily appear in descending order according to the number of bytes in the file. The 8B entry indicates that each of these files has been allocated the minimum amount of disk space (4096 / 512 = 8 ) and is therefore equal in the terms of the sort operation.
|/usr/bin/li||Contains the li command.|
|/etc/passwd||Contains user names for li -Io.|
|/etc/group||Contains group names for li -Ig.|
The aclget command, chmod command, chtcb command, ls command, mkpasswd command.
The chmod subroutine.
Directory Overview in AIX Version 4.3 System User's Guide: Operating System and Devices describes the structure and characteristics of directories in the file system.
Files Overview in the AIX Version 4.3 System Management Guide: Operating System and Devices describes files, file types, and how to name files.
Shells Overview in AIX Version 4.3 System User's Guide: Operating System and Devices describes what shells are, the different types of shells, and how shells affect the way commands are interpreted.
File and Directory Access Modes in the AIX Version 4.3 System User's Guide: Operating System and Devices introduces file ownership and permissions to access files and directories.
National Language Support Overview for Programming in the AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs explains collating sequences, equivalence classes, and locale.