Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

acc(1)

cc(1)

chmod(1)

find(1)



  ls(1)                               CLIX                               ls(1)



  NAME

    ls - Lists contents of directory

  SYNOPSIS

    ls [-RadCxmlnogrtucpFbqisfL] [name ... ]

  FLAGS

    -R   Recursively list subdirectories encountered.

    -a   List all entries, including those that begin with a dot (.), which
         are normally not listed.

    -d   If an argument is a directory, list only its name (not its contents).
         This flag is often used with -l to get the directory's status.

    -C   Display multicolumn output with entries sorted down the columns.

    -x   Display multicolumn output with entries sorted across rather than
         down the page.

    -m   Display in stream output format; files are listed across the page
         separated by commas.

    -l   List in long format giving mode, number of links, owner, group, size
         (in bytes), and time of last modification for each file (see below).
         If the file is a special file, the size field will contain the major
         and minor device numbers rather than a size.  If the file is a
         symbolic link, the pathname the link references is displayed preceded
         by an arrow (->).

    -n   Same as -l except that the owner's UID and group's GID numbers are
         displayed rather than the associated character strings.

    -o   Same as -l except that the group is not displayed.

    -g   Same as -l except that the owner is not displayed.

    -r   Reverse the sort order to get reverse alphabetic or oldest first as
         appropriate.

    -t   Sort by time stamp (latest first) instead of by name.  The default is
         the last modification time.  (See -u and -c.)

    -u   Use the last access time instead of modification time for sorting
         (with the -t flag) or displaying (with the -l flag).

    -c   Use the last inode modification time (such as when a file was created
         or a mode changed) for sorting (-t) or displaying (-l).



  2/94 - Intergraph Corporation                                              1






  ls(1)                               CLIX                               ls(1)



    -p   Put a slash (/) after each filename if the file is a directory.

    -F   Put a slash (/) after each filename if the file is a directory, put
         an asterisk (*) after each filename if the file is executable, and
         put an at sign (@) after each filename if the file is a symbolic
         link.

    -b   Force nongraphics characters in filenames to be displayed in the
         octal \ddd notation.

    -q   Force nongraphics characters in filenames to be displayed as the
         character ?.

    -i   For each file, display the inode number in the first column of the
         report.

    -s   Give size in blocks (including indirect blocks) for each entry.

    -f   Force each argument to be interpreted as a directory and list the
         name found in each slot.  This flag turns off -l, -t, -s, and -r and
         turns on -a; the order is the order in which entries appear in the
         directory.

    -L   If an argument is a symbolic link, display the information about the
         file or directory the link references rather than about the link
         itself.

  DESCRIPTION

    The ls command lists the directory contents for each directory argument;
    for each file argument, ls repeats its name and any other information
    requested.  The output is sorted alphabetically by default.  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.

    There are three major listing formats.  The default format lists one entry
    per line.  The -C and -x flags enable multicolumn formats, and the -m flag
    enables stream output format.  To determine output formats for the -C, -x,
    and -m flags, ls uses the environment variable COLUMNS to determine the
    number of character positions available on one 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 are assumed.

    The mode displayed under the -l flag consists of ten characters.  The
    first character can be one of the following:

    d   The entry is a directory.

    b   The entry is a block special file.



  2                                              Intergraph Corporation - 2/94






  ls(1)                               CLIX                               ls(1)



    c   The entry is a character special file.

    l   The entry is a symbolic link.

    p   The entry is a fifo (named pipe) special file.

    -   The entry is an ordinary file.

    The next nine characters are interpreted as sets of three bits each.  The
    first set refers to the owner's permissions; the next set refers to
    permissions of others in the file's user group; and the last set refers to
    all others.  Within each set, the three characters indicate (respectively)
    permission to read, write, and execute the file as a program.  Execute
    permission for a directory is permission to search the directory for a
    specified file.

    ls -l displays its output as follows:

    -rwxrwxrwx  1 smith  dev    10876  May 16 9:42 part2

    This horizontal configuration provides a lot of information.  Reading from
    right to left, it is seen that the current directory holds one file,
    ``part2''.  Next, the last time the file's contents were modified was 9:42
    AM on May 16.  The file is moderately sized, containing 10,876 characters,
    or bytes.  The file owner, or the user, belongs to the group ``dev'', and
    the login name is ``smith''.  The number (in this case ``1'') indicates
    the number of links to file ``part2''.  Finally, the row of dashes and
    letters shows that user, group, and others have permission to read, write,
    and execute ``part2''.

    The execute (x) symbol occupies the third position of the three-character
    sequence.  A - in the third position would have indicated a denial of
    execution permissions.

    The permissions are indicated as follows:

    r   The file is readable.

    w   The file is writable.

    x   The file is executable.

    -   The indicated permission is not granted.

    l   Mandatory locking will occur during access.  (The set-group-ID bit is
        on and the group execution bit is off.)

    s   The set-user-ID or set-group-ID bit and the corresponding user or
        group execution bit are on.

    S   Undefined bit-state.  (The set-user-ID bit is on and the user



  2/94 - Intergraph Corporation                                              3






  ls(1)                               CLIX                               ls(1)



        execution bit is off).

    t   The 1000 (octal) bit, or sticky bit (see hmod()), and the execution
        bit are on.

    T   The 1000 bit is on and execution is off (undefined bit-state).

    For user and group permissions, the third position is sometimes occupied
    by a character other than x or -.  The s, referring to the state of the
    set-ID bit (the user's or the group's), can also occupy this position.
    For example, the ability to assume the same ID as the user during
    execution is used during login when the user begins as root but needs to
    assume the identity stated at login.

    In the sequence of group permissions, l can occupy the third position.  l
    refers to mandatory file and record locking.  This permission describes a
    file's ability to allow other files to lock its reading or writing
    permissions during access.

    For others permissions, the third position can be occupied by t or T.
    These refer to the state of the sticky bit and execution permissions.

  EXAMPLES

    1.  This example describes a file that the user can read, write, and
        execute and that group and others can read:

        -rwxr--r--


    2.  This example describes a file that the user can read, write, and
        execute and that group and others can read and execute.  This
        permission allows the user presently executing it to assume its user
        ID during execution:

        -rwsr-xr-x


    3.  This example describes a file that only the user and group can read
        and write and that can be locked during access:

        -rw-rwl---


    4.  This command will display the names of all files in the current
        directory, including those that begin with a dot (.), which normally
        do not display:

        ls -a





  4                                              Intergraph Corporation - 2/94






  ls(1)                               CLIX                               ls(1)



    5.  This command will provide information such as all files (including
        nondisplaying ones (a)); the i-number, the memory address of the inode
        associated with the file, displayed in the left-hand column (i); and
        the size of the files (in blocks) displayed in the column to the right
        of the i-numbers (s).  The report is displayed in the numeric version
        of the long list, displaying the UID (instead of username) and GID
        (instead of group name) numbers associated with the files.

        ls -aisn

        When the sizes of the files in a directory are listed, a total count
        of blocks, including indirect blocks, is displayed.

  FILES

    /etc/passwd             UIDs for ls -l and ls -o

    /etc/group              GIDs for ls -l and ls -g

    /usr/lib/terminfo/?/*   Terminal information database

  NOTES

    In a Remote File Sharing (RFS) environment, a user cannot have the
    permissions that the output of the ls-l command implies.

    Undisplayable characters in filenames can confuse the columnar output
    flags.

  DIAGNOSTICS

    ls: out of memory
           Could not allocate enough memory to continue.

    can not access directory dirname
           You do not have permission to look here.

  EXIT VALUES

    The ls command exits with a value of 0 if successful and a value of 1 or 2
    if an error occurs.

  RELATED INFORMATION

    Commands: acc(1), cc(1), chmod(1), find(1)

    AT&T UNIX System V System Administrator's Guide.







  2/94 - Intergraph Corporation                                              5




Typewritten Software • bear@typewritten.org • Edmonds, WA 98026