Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cat(1)

chmod(1)

find(1)

rm(1)



LS(1)                   COMMAND REFERENCE                   LS(1)



NAME
     ls, lf, lg, ll, lr, lx - list contents of directory

SYNOPSIS
     ls [ -1 ] [ -A ] [ -C ] [ -F ] [ -L ] [ -R ] [ -a ] [ -c ] [
     -d ] [ -f ] [ -g ]
     [ -h ] [ -i ] [ -l ] [ -q ] [ -r ] [ -s ] [ -t ] [ -u ] [ -x
     ] filename...

DESCRIPTION
     For each argument that names a directory or symbolic link to
     a directory (unless -l is specified), ls lists the contents
     of the directory; for each file argument, ls repeats its
     name and any other information requested.  By default, the
     output is sorted alphabetically.  When no argument is given,
     the current directory is listed.  When several arguments are
     given, the arguments are first sorted appropriately, but
     file arguments are processed before directories and their
     contents.

     The commands lf, lg, ll, lr, and lx are links to ls which
     set flags as follows:

          lf sets the flag -F

          lg sets the flags -l, -g

          ll sets the flag -l

          lr sets the flag -R

          lx sets the flag -x

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

          b  if the entry is a block-type special file;

          c  if the entry is a character-type special file;

          d  if the entry is a directory;

          D  if the entry is a symbolic link that points to a
             directory;

          l  if the entry is a symbolic link, or

          s  if the entry is a socket

          -  if the entry is a plain file.





Printed 4/6/89                                                  1





LS(1)                   COMMAND REFERENCE                   LS(1)



     The next 9 characters are interpreted as three sets of three
     bits each.  The first set refers to owner permissions; the
     next set refers to permissions to other people in the same
     user-group; and the last set refers to permissions for all
     other people outside your user-group.  Within each set the
     three characters indicate permission (respectively) to read,
     to write, or to execute the file as a program.  For a
     directory, `execute' permission is interpreted to mean
     permission to search the directory.  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 the indicated permission is not granted.

     The group-execute permission character is given as s if the
     file has the set-group-id bit set; likewise the user-execute
     permission character is given as s if the file has the set-
     user-id bit set.

     The last character of the mode (normally `x' or `-') is t if
     the 1000 bit of the mode is on.  See chmod(1) for the
     meaning of this mode.

     When the sizes of the files in a directory are listed, a
     total count of blocks is printed.  If you find the size
     using the -s option, this reflects the actual amount of disk
     space a file consumes.  In this case, a count of indirect
     blocks is also printed.  If you find the size using the -l
     option, a count of indirect blocks is NOT included.  The
     size obtained with -l is not the actual number of bytes, but
     an end-of-data location; unless the file was created by
     skipping around and writing, this is the actual number of
     bytes consumed.

OPTIONS
     -a List all entries; in the absence of this option, entries
        whose names begin with a period or dot ( . ) are not
        listed.

     -A List all entries except '.' and '..'; this option is
        always set for the superuser.

     -c Use time of the last file status change for sorting (with
        the -t option) and/or printing (with the -l option).
        This time is the last time that the file's data or the
        inode was changed (meaning the last time the data was
        changed or the file was linked to. See the manual page



Printed 4/6/89                                                  2





LS(1)                   COMMAND REFERENCE                   LS(1)



        stat(2) for more information).

     -C Force multi-column output; this is the default when
        output is to a terminal.

     -d If argument is a directory, list only its name; often
        used with -l to get the status of a directory.

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

     -F Mark directories with a trailing `/', mark symbolic links
        with a trailing `@', mark executable files with a
        trailing `*', and mark sockets with a trailing '='.  All
        symbolic links to existing directories are marked with a
        trailing `@/'.  All symbolic links to existing executable
        files are marked with a trailing `@*'.  All symbolic
        links to nonexistent files are marked with a trailing
        `@?'.

     -g Include the group ownership of the file in a long output.

     -h Follow only ``hard'' directory paths during recursion (-R
        option).  By default, symbolic links to directories are
        traversed (except when -l is used without -L).  This
        option prevents these symbolic links from being
        traversed.

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

     -l List in long format, giving mode, number of links, owner,
        size in bytes, and time of last modification for each
        file.  If the file is a special file the size field will
        instead contain the major and minor device numbers.  If
        the file is a symbolic link the path name of the linked-
        to file is printed preceded by ``->''.

     -L If argument is a symbolic link, list the file or
        directory the link references rather than the link
        itself.

     -q Force printing of non-graphic characters in file names as
        the character `?'; this is the default when output is to
        a terminal.

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

     -R Recursively list subdirectories encountered.  (Note: In



Printed 4/6/89                                                  3





LS(1)                   COMMAND REFERENCE                   LS(1)



        order to avoid symbolic link loops, directories are only
        traversed the first time they are encountered, whether as
        a regular directory or as a symbolic link.)

     -s Give size of each file in kilobytes.

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

     -u Use time of last access instead of last modification for
        sorting (with the -t option) and/or printing (with the -l
        option).

     -x List only directories. If the -L option is also given,
        symbolic links to directories will also be listed.

     -1 Force one entry per line output format; this is the
        default when output is not to a terminal.

EXAMPLES
     The following example lists all files in the directory /bin.

          ls /bin

FILES
     /etc/passwd  gets user id's for ls -l command

     /etc/group   gets group id's for ls -g command

RETURN VALUE
     [NO_ERRS]      Command completed without error.

     [NP_ERR]       An error occurred that was not a system
                    error.  Execution terminated.

     [P_WARN]       A system error occurred. Execution continues.
                    See intro(2) for more information on system
                    errors.

CAVEATS
     Newline and tab are considered printing characters in file
     names.

     The output device is assumed to be 80 columns wide.

     The date printed in the long listing (-l option) will
     contain the time of day if the file is up to six months old
     or has a date up to 48 hours in the future.  All other dates
     will print with the year instead of the time.

     The option setting based on whether the output is a teletype
     is undesirable because ls -s is much different than ls -s |
     lpr.  On the other hand, not doing this setting would make



Printed 4/6/89                                                  4





LS(1)                   COMMAND REFERENCE                   LS(1)



     old shell scripts which used ls almost certain losers.

     The commands lf(1), lg(1), ll(1), lr(1), and lx(1) are not
     separate programs; they are links to ls.  Therefore,
     removing these commands will not free up a lot of disk
     space; this also means that modifying ls requires relinking
     the commands.

SEE ALSO
     cat(1), chmod(1), find(1), and rm(1).













































Printed 4/6/89                                                  5



%%index%%
na:192,103;
sy:295,701;
de:996,1904;3164,1878;
op:5042,752;6058,2629;8951,839;
ex:9790,181;
fi:9971,195;
rv:10166,459;
ca:10625,670;11559,418;
se:11977,200;
%%index%%000000000190

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