LS(1)                                                       LS(1)

     NAME
          ls, lc - list contents of directory

     SYNOPSIS
          ls [ -dlnpqrstuF ] name ...

          lc [ -dlnqrstuF ] name ...

     DESCRIPTION
          For each directory argument, ls lists the contents of the
          directory; for each file argument, ls repeats its name and
          any other information requested.  When no argument is given,
          the current directory is listed.  By default, the output is
          sorted alphabetically by name.

          Lc is the same as ls, but sets the -p option and pipes the
          output through mc(1).

          There are a number of options:

          -d   If argument is a directory, list it, not its contents.

          -l   List in long format, giving mode (see below), file sys-
               tem type (e.g., for devices, the # code letter that
               names it; see Intro(4)), the instance or subdevice num-
               ber, owner, group, size in bytes, and time of last mod-
               ification for each file.

          -n   Don't sort the listing.

          -p   Print only the final path element of each file name.

          -q   List the qid (see stat(2)) of each file.

          -r   Reverse the order of sort.

          -s   Give size in Kbytes for each entry.

          -t   Sort by time modified (latest first) instead of by
               name.

          -u   Under -t sort by time of last access; under -l print
               time of last access.

          -F   Add the character / after all directory names and the
               character * after all executable files.

          The mode printed under the -l option contains 11 characters,
          interpreted as follows: the first character is

     Page 1                       Plan 9            (printed 11/18/24)

     LS(1)                                                       LS(1)

          d    if the entry is a directory;
          a    if the entry is an append-only file;
          -    if the entry is a plain file.

          The next letter is l if the file is exclusive access (one
          writer or reader at a time).

          The last 9 characters are interpreted as three sets of three
          bits each.  The first set refers to owner permissions; the
          next to permissions to others in the same user-group; and
          the last to all others.  Within each set the three charac-
          ters indicate permission respectively to read, to write, or
          to execute the file as a program.  For a directory, `exe-
          cute' permission is interpreted to mean permission to search
          the directory for a specified file.  The permissions are
          indicated as follows:

          r  if the file is readable;
          w  if the file is writable;
          x  if the file is executable;
          -  if none of the above permissions is granted.

     SOURCE
          /sys/src/cmd/ls.c
          /rc/bin/lc

     SEE ALSO
          stat(2) mc(1)

     Page 2                       Plan 9            (printed 11/18/24)