home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 2 / CDPD_II_2352.bin / scope / 126-150 / scopedisk145 / ls40 / ls.doc < prev    next >
Text File  |  1992-10-27  |  20KB  |  498 lines

  1.  
  2.      LS(1)                        AmigaOS 1.3                    LS(1)
  3.  
  4.  
  5.      NAME
  6.       ls - list contents of directory
  7.  
  8.  
  9.      SYNOPSIS
  10.       ls [ [ -options <args> ] [ names ] ] ...
  11.  
  12.  
  13.      DESCRIPTION
  14.       For each directory name argument, ls lists the contents of the
  15.       directory; for each file name argument (non-wildcarded), ls
  16.       lists the entry using the long listing format.  If wildcards
  17.       (* or ?) are passed to ls, it internally expands the filespec
  18.       into a list of names, and lists them in the requested format
  19.       (short, long, or single column).
  20.  
  21.       The output is sorted alphabetically, by default, and the short
  22.       format listing is used unless the argument name is a "fully named
  23.       path" (i.e., one without wildcards), or an option flag requests a
  24.       different format.
  25.  
  26.       When no argument is given, the current directory is listed.  When
  27.       several arguments are given, the arguments are processeed in the
  28.       order presented, with "non-sticky" option flags being reset to the
  29.       default value between arguments.  Option flags may preceed the
  30.       individual name arguments.
  31.  
  32.       There are three major listing formats.  The default format is to
  33.       list the entries in a short, columnar format, with entries sorted
  34.       down the columns.  The long and single column (one entry per line)
  35.       formats are enabled with various options.
  36.  
  37.       For the short format, ls reads the size of the current window to
  38.       determine the character positions available on one line, and the
  39.       number of lines available without scrolling.    If this information
  40.       cannot be obtained, ls assumes 77 columns by 23 lines.  A builtin
  41.       "pager" is available by default when the short format is used.
  42.  
  43.       The output formats and applicable option switches are designed to
  44.       emulate the UNIX(R) equivalent as closely as possible.
  45.  
  46.       The options are as follows:
  47.  
  48.            -a   Lists entries including those whose names begin with a
  49.             dot (.)  These are not listed by default.
  50.  
  51.            -b   Normally, the long format listing shows the total number
  52.             of blocks used by an entry (including the File Header
  53.             and Extension blocks).  This option limits the block
  54.             count to the number of Data Blocks only.
  55.  
  56.            -c   Shows the comment/filenote for an entry, if any.  The
  57.             comment is shown enclosed in quote marks on a line
  58.             beneath the entry.    This option implies the long format
  59.             listing.
  60.  
  61.            -d   Show only entries that are directories.
  62.  
  63.            -e   By default, ls shows the "execute" attribute bit in the
  64.             long format listing as an "x".  This option changes that
  65.             to an "e".  [sticky]
  66.  
  67.            -f   Show only entries that are files (i.e., not directories).
  68.  
  69.            -h   Lists entries including those whose "hidden" attribute
  70.             bit is set.  These are not listed by default.
  71.  
  72.            -i   Lists entries including those whose names end with the
  73.             string ".info".  These are not listed by default.
  74.  
  75.            -k   The output listing is sorted by the disk "key" value of
  76.             the entries.  [sticky]
  77.  
  78.            -l   Lists in long format, giving the entrys' attribute bits,
  79.             comment present flag, disk key (if -k or -K specified),
  80.             size in blocks, size in bytes, date, and name.
  81.  
  82.            -m   Lists entries with the case "mixed".  Normally, the case
  83.             of entry names is respected when sorting.
  84.  
  85.            -n   No sorting of entries is performed.  Entries are listed
  86.             the order in which they are Examined by the system.
  87.  
  88.            -o   Use the old ls version (v3.1) long format when a long
  89.             listing is requested.  Note: this option does not cause
  90.             a long listing by itself, but only specifies that the
  91.             old format be used, should a long listing be requested
  92.             (see notes below).
  93.  
  94.            -p   Puts a slash (/) after each entry name if that entry is
  95.             a directory.
  96.  
  97.            -q   Normally, ls will continue to process name arguments
  98.             until the argument list is exhausted.  This option will
  99.             cause ls to terminate when an entry is not found.  (This
  100.             option only has meaning for "fully named path" args).
  101.  
  102.            -r   Reverses the sort order to get reverse alphabetic, oldest,
  103.             smallest, or highest key first as appropriate.
  104.  
  105.            -s   Sort by size, with largest first.  [sticky]
  106.  
  107.            -t   Sort by date, with newest first.  [sticky]
  108.  
  109.            -u   Display a short usage summary, showing syntax and options.
  110.  
  111.            -v   Use variable column widths in the short format listing.
  112.             Normally, ls bases the column widths on the longest name
  113.             in the directory, and uses that value for all columns.
  114.             This option allows each column's width to be determined
  115.             by the longest name in the column itself.
  116.  
  117.            -x pat
  118.             Excludes entries matching the pattern "pat" from the
  119.             listing.  The pattern string may contain "*" and "?",
  120.             which are interpreted as wildcards with the usual meaning.
  121.             [sticky]
  122.  
  123.            -z   Overrides the calculation of the block counts, and shows
  124.             the value found in the filesystem's NumBlocks entry.
  125.             This option is useful for getting an indication of a
  126.             file's current block size if the file is being written to,
  127.             or if the file resides on a psuedo-device (such as a
  128.             "pathass" assign) that has no inherent bytes/block value.
  129.             Note: the block count reported should only be used as an
  130.             indicator, as it may not be exact.
  131.  
  132.            -A   Lists all entries.    This option is equivalent to using
  133.             the a, h, and i options together.  Note: entries matching
  134.             the exclude pattern (-x) are not listed.
  135.  
  136.            -B size
  137.             Normally, ls computes an entry's block count using the
  138.             bytes/block value appropriate for the filesystem or
  139.             device on which the entries reside (currently 512 for the
  140.             FFS, and 488 for the OFS).    This option allows that value
  141.             to be specified directly, which can be useful to determine
  142.             if an entry or entries will "fit" on a device which has a
  143.             different bytes/block value.  In such usage, the "size"
  144.             of the target device would be specified by the option's
  145.             argument, and the block count obtained then compared to
  146.             the number of blocks available on the target device (with
  147.             Info, for example).  [sticky]
  148.  
  149.            -C   Single column (one entry per line) output format.  Note:
  150.             this usage of "-C" is exactly opposite UNIX's usage.
  151.  
  152.            -D   Normally, files and directories are intermixed in the
  153.             output listings.  With this option, all directories will
  154.             appear seperately, and last in the listing.
  155.  
  156.            -E   Normally, ANSI escape codes are used to highlight names
  157.             of directory entries and comments.    This option disables
  158.             such highlighting.    Note: ANSI escape codes are normally
  159.             automatically disabled when the ls output is redirected
  160.             to stdout or is piped.  [sticky]
  161.  
  162.            -F <format>
  163.             Allows the specification of the output format when the
  164.             old long format is used.  This option implies -l and -o
  165.             (see notes below).
  166.  
  167.            -G   Disables the subdirectory-by-subdirectory summary totals
  168.             normally provided when the long format listing is used.
  169.  
  170.            -H   Disables printing of the subdirectory name header line
  171.             normally provided for other than the current directory.
  172.  
  173.            -I   Normally, when using the short format, if the number of
  174.             entries is larger than can be displayed in the window ls
  175.             is using, a builtin "pager" is invoked to prevent the
  176.             list from scrolling.  This option (as well as output re-
  177.             direction or pipeing) inhibits the pager.
  178.  
  179.            -K   Display disk "keys" in the long format listing.  Normally,
  180.             they are not shown.  This option implies the long format.
  181.  
  182.            -Ln  Recursively lists subdirectories encountered, with depth
  183.             limited to "n" levels.  A depth of n = 1 lists only the
  184.             current directory.
  185.  
  186.            -M   Ignore alphabetic case when matching directory contents
  187.             with wildcard patterns.  Normally, the case of names is
  188.             respected.    This option applies to both name arguments,
  189.             and exclude (-x) patterns.
  190.  
  191.            -N name
  192.             Show only entries that are newer than entry "name".
  193.             "Name" cannot be wildcarded.
  194.  
  195.            -O name
  196.             Show only entries that are older than entry "name".
  197.             "Name" cannot be wildcarded.
  198.  
  199.            -P   Show entry names as full (absolute) path names.  This
  200.             option implies the long format.
  201.  
  202.            -Q   Normally, ls disables the system requesters that pop up
  203.             when a device is empty, etc, and presents an error msg.
  204.             This option turns them on again.  [sticky]
  205.  
  206.            -R   Recursively lists subdirectories encountered.
  207.  
  208.            -S   Normally, files and directories are intermixed in the
  209.             output listings.  With this option, all directories will
  210.             appear seperately, and first in the listing.
  211.  
  212.            -T   Provides a grand total of all files and directories, and
  213.             their sizes, for all entries processed.  This option is
  214.             valid with all formats.  Note: the seperate totalization
  215.             line will not be printed, if the information is simply a
  216.             duplication (as it would be for just a long format list
  217.             of the current directory).
  218.  
  219.            -V   Show entry names as relative (to the current directory)
  220.             path names.  This option implies the long format.
  221.  
  222.            -W   Normally, when a "wildcarded match" occurs on a directory
  223.             entry, its contents are listed.  This option prevents the
  224.             contents from being listed.  Only the directory name will
  225.             be printed.
  226.  
  227.            -X width
  228.             Forces the short format to use "width" for the number of
  229.             columns available in ls's window.  [sticky]
  230.  
  231.            -Y height
  232.             Forces the short format to use "height" for the number of
  233.             lines available in ls's window.  [sticky]
  234.  
  235.            -Z   Forces output of ANSI escape sequences for highlighting,
  236.             even though the ls output may be redirected to stdout, or
  237.             piped.  See also, -E.  [sticky]
  238.  
  239.            -0 thru
  240.            -6   Specifies the format to be used for the date in the long
  241.             listing (not applicable to the -o long format).  [sticky]
  242.  
  243.             Available formats are:
  244.                0: age to years:  mmm  d hh:mm  aging to  mmm dd  yyyy
  245.                1: full:      mmm dd yyyy  hh:mm:ss
  246.                2: dash alpha:     dd-mmm-yy hh:mm:ss
  247.                3: dash numeric:  mm-dd-yy hh:mm:ss
  248.                4: slash:     mm/dd/yy hh:mm:ss
  249.                5: european:     dd/mm/yy hh:mm:ss
  250.                6: dot:         yy.mm.dd hh:mm:ss
  251.  
  252.             Format 0 is the default, and is the format used by UNIX.
  253.             The "aging" period is 180 days, and the day may be either
  254.             one or two digits, as required.
  255.  
  256.            -?   Synonym for "-u".  Displays a short usage summary.
  257.  
  258.            -    Forces the next argument to be interpreted as a name.
  259.             This is useful for specifying entries whose names begin
  260.             with the "-" character.
  261.  
  262.  
  263.       The attribute bits printed in the default long format consist of a
  264.       nine character string.  Each position contains a letter if the
  265.       attribute it represents is "true", or a "-" otherwise.  If all
  266.       attributes were to apply to a single entry, the string would appear
  267.       as "dhsparwxd", where:
  268.  
  269.          d    indicates the entry is a directory
  270.          h    indicates the entry is a hidden entry
  271.          s    indicates the entry is a script file
  272.          p    indicates the entry is a pure executable (residentable)
  273.          a    indicates the entry has been archived, and not modified since
  274.          r    indicates the entry is readable
  275.          w    indicates the entry is writable
  276.          x    indicates the entry is executable (or "e" with the -e option)
  277.          d    indicates the entry is deletable
  278.  
  279.       It should be noted that AmigaOS 1.3 includes only marginal support
  280.       of the attribute bits, and enforces few of them.  The above however
  281.       is their formal definition.  Also, "directory" is not an attribute
  282.       bit, but is included in the attribute string.  Further, a "c" flag
  283.       will appear to the right of the attribute string should an entry
  284.       have an associated comment/filenote (or a blank if not).
  285.  
  286.       AmigaOS makes provisions for additional attributes, some of which
  287.       may be application specific.    Should any of these be set, ls will
  288.       display a "+" instead of a "-" in the hidden attribute position,
  289.       or an "H" if the hidden attribute itself also applies.
  290.  
  291.  
  292.       The ls -l (default long list) command prints its output as follows:
  293.  
  294.            --sa-rw-d c   136    65383  May    5 18:15  fubar
  295.  
  296.       This horizontal configuration provides a good deal of information.
  297.       From right to left, you see that the current directory holds one
  298.       file, named "fubar".  It was created (or at least last modified) at
  299.       6:15 P.M. on May 5th.  It contains 65,383 bytes, and occupies 136
  300.       blocks on the device where it is located (including the file header
  301.       block, and any extension blocks).  There is a comment associated
  302.       with the file, and it is (supposedly) a script file that has been
  303.       archived, and may be read, written, and deleted.
  304.  
  305.  
  306.      EXAMPLES
  307.            ls -a
  308.  
  309.       This command prints the names of all files in the current directory,
  310.       including those that begin with a dot (.), which normally are not
  311.       printed.  The short format is used.
  312.  
  313.  
  314.            ls -cAKP1
  315.  
  316.       This command provides you with a maximum amount of information on
  317.       all files in the current directory, including those that normally
  318.       do not print (A), associated comments, if any (c), the disk key
  319.       numbers (K), the full path name (P), and the full date format (1).
  320.       A long format listing is implied (both c and P).
  321.  
  322.  
  323.            ls -ARTB488
  324.  
  325.       This command prints the names of all files in the current directory
  326.       (A), and all subdirectories below it (R), with a grand total of the
  327.       counts and sizes at the end (T).  Block counts are computed as if
  328.       the files were located on an OFS (Old File System) device (B488),
  329.       and the short format is used.
  330.  
  331.       If the files were actually located on an FFS (Fast File System)
  332.       device, such as a hard disk partition, comparing the grand total of
  333.       the block counts to the available blocks on an OFS floppy (with say,
  334.       Info) would tell you if the tree would fit on the floppy.
  335.  
  336.  
  337.            ls -hrtX50 -Y 15 -Tx*zoo
  338.  
  339.       This command prints a short format listing of the current directory,
  340.       including hidden files (h), sorted by date (t), with oldest files
  341.       first (r).  The output "window" is restricted to 50 columns (X50),
  342.       by 15 lines (Y 15).  A totalization of all entries is requested (T),
  343.       and entries ending with the string "zoo" will be excluded (x*zoo).
  344.  
  345.  
  346.            ls -lN df0:emily.c -sOdf1:lynn.c df0:*.c
  347.  
  348.       This command prints a long format listing (l) of all files ending
  349.       with the string ".c" on df0: that are newer than "df0:emily.c"
  350.       (N df0:emily.c), but are older than "df1:lynn.c" (Odf1:lynn.c).
  351.       The listing will be sorted by size, with largest files first (s).
  352.  
  353.  
  354.      NOTES
  355.       Wildcards:
  356.       ----------
  357.       Normal wildcards may be used in file names and in the last level of
  358.       a directory path name.  The "*" character is used to match any
  359.       number of characters (including zero), and a "?" matches any single
  360.       character.  Wildcards may also be used in specifying an exclusion
  361.       pattern (-x).
  362.  
  363.       If the shell that is used to invoke ls expands the wildcards itself,
  364.       they MUST be quoted in some manner for ls to work as intended.
  365.       Some common shell quoting methods are:  "*" or \* or '*   See your
  366.       shell documentation for details.
  367.  
  368.  
  369.       Options:
  370.       --------
  371.       Option flags may be given in any order.  Where options conflict,
  372.       such as specifying both -s and -t, the last option encountered is
  373.       the one used.
  374.  
  375.       Option flags may be given grouped or seperately.  E.g., "-lsR" is
  376.       logically the same as "-l -s -R".
  377.  
  378.       Options requiring an argument, such as -x or -B, must be the last
  379.       option in a group, or given seperately, and must be immediately
  380.       followed by the argument (with or without seperating blanks).  The
  381.       forms:  "-ltB488",  "-ltB 488",  "-lt -B488",  and "-l -B   488 -t"
  382.       are all correct, and logically the same.  The form "-lB488t" is
  383.       NOT correct, and will result in unspecified behavior.
  384.  
  385.       Options are normally reset to their default state between name
  386.       arguments.  Some flags however, apply to all name arguments, and
  387.       are identified as "sticky" in the option descriptions above.
  388.  
  389.  
  390.       Pathnames:
  391.       ----------
  392.       A pathname with spaces in it like "Wombat Soup", must be surrounded
  393.       by quotes.  Up to 30 seperate pathname patterns can be processed by
  394.       ls per command.
  395.  
  396.  
  397.       Aborting:
  398.       ---------
  399.       ls may be aborted at any time by issuing a control-C (assuming the
  400.       invoking shell passes ^C's along to the applications).  ls will
  401.       print the string "**BREAK" and then terminate when this occurs.
  402.  
  403.  
  404.       Formatted Output:
  405.       -----------------
  406.       For customized output, there is a special option that expects a
  407.       format rule as the next argument:
  408.  
  409.       -F <format>
  410.            Format output with <format), using the following symbols:
  411.           %p  print the attribute bits
  412.           %d  print the date: yy-mm-dd
  413.           %t  print the time: hh-mm-ss
  414.           %b  print the number of blocks used by the entry
  415.           %s  print the number of bytes  used by the entry
  416.           %n  print the name of the entry
  417.           %%  print a percent symbol
  418.           \n  print a linefeed
  419.           \t  print a tab
  420.           \\  print a backslash symbol
  421.  
  422.            The default format rule that ls uses for old format long
  423.            listings is:  -F "%p %d %t %4b %8s %n\n".   Note that a format
  424.            specification that contains spaces must be quoted.
  425.  
  426.            Any of the format options that begin with the '%' symbol can
  427.            have an optional pad count that lets you specify how many
  428.            columns to use.    For example:  -F "%40n\n"  would print each
  429.            entry name right justified in a field of 40 columns.
  430.  
  431.            The attribute bits in this format are as described above, with
  432.            one exception: the first position is used to indicate that the
  433.            entry has an associated comment.  If so, a "c" is used (else a
  434.            "-").
  435.  
  436.            You can use this feature of ls to help create simple batch
  437.            command files.  For example, the command:
  438.  
  439.           ls -PF "copy %n RAM:\n" df0:*.h
  440.  
  441.            tells ls to perform a listing using full pathnames with a
  442.            special format, matching only filenames that end with ".h" in
  443.            directory df0:.    Suppose df0: has the following files in it:
  444.  
  445.           joe.h  fred.h  pete.h  ted.h
  446.  
  447.            The example ls command would result in the following list of
  448.            commands:
  449.  
  450.           copy df0:fred.h RAM:
  451.           copy df0:joe.h RAM:
  452.           copy df0:pete.h RAM:
  453.           copy df0:ted.h RAM:
  454.  
  455.            A script file from this by redirecting the output of ls to a
  456.            temporary file:
  457.  
  458.           ls >ram:templist -PF "copy %n RAM:\n" df0:*.h
  459.           execute ram:templist      ; do the script,
  460.           delete ram:templist      ;    and delete it
  461.  
  462.  
  463.       Tip:
  464.       ----
  465.       To list files older or newer than a certain date, rather than a
  466.       certain file, you can do this:
  467.  
  468.            echo >RAM:datemark "Marker"    ; create a temp file in RAM:
  469.            setdate RAM:datemark 07-Jul-89 ; set datestamp for temp file
  470.            ls -N ram:datemark df0:          ; list files newer than "datemark"
  471.            delete ram:datemark          ; remove temp file
  472.  
  473.  
  474.      CAVEATS/BUGS
  475.       Refer to the README file accompanying this distribution for notes
  476.       of any currently known bugs or limitations.
  477.  
  478.  
  479.      AUTHORS
  480.       Justin V. McCormick is the author of the of ls (v3.1), and other
  481.       earlier revisions.  Version 3.1 was used as a base on which to
  482.       develop the current revision (v4.0k), because of its excellent
  483.       "inline" sorting and its columnation algorithms, as well as its
  484.       small size, and fast code.
  485.  
  486.       Kim E. DeVaughn provided the numerous enhancements, fixes, etc, to
  487.       bring v3.1 up to the current v4.0k.
  488.  
  489.  
  490.      COPYRIGHT
  491.       ls v4.0k is (c) Copyright 1990, Kim E. DeVaughn, all rights
  492.       reserved.  See the "License" accompanying this distribution for
  493.       limitations, and other details.
  494.  
  495.       UNIX is a registered trademark of AT&T.  They had nothing to do
  496.       with any of this code, but did provide the "model" for some of its
  497.       output formats and options.
  498.