Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ls(C) — OpenDesktop 1.1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(C)

coltbl(M)

find(C)

l(C)

lc(C)

locale(M)

termcap(F)


     LS(C)                                UNIX System V



     Name
          ls - gives information about contents of directories


     Syntax
          ls [ -ACFRabcdfgilmnopqrstux ] [ names ]


     Description
          For each directory named, ls  lists  the  contents  of  that
          directory;  for each file named, 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, file
          arguments  are  processed  before  directories   and   their
          contents.

          There are three major listing formats.  The  default  format
          is  to list one entry per line, the -C and -x options enable
          multi-column formats,  and  the  -m  option  enables  stream
          output  format  in  which  files are listed across the page,
          separated by commas.  In order to  determine  output  format
          for  the  -C,  -x,  and  -m  options, ls uses an environment
          variable, COLUMNS, to  determine  the  number  of  character
          positions available on one output line.  If this variable is
          not set, the termcap  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.

          There are many options:

          -A   List all entries.  Entries  whose  name  begin  with  a
               period (.) are listed.  Does not list current directory
               (.) and directory above (..).

          -a   Lists all entries. Entries  whose  name  begin  with  a
               period (.) are listed.

          -R   Recursively lists subdirectories encountered.

          -d   If an argument is a directory, lists only its name (not
               its  contents); often used with -l to get the status of
               a directory.

          -C   Multi-column  output  with  entries  sorted  down   the
               columns.

          -x   Multi-column output with entries sorted  across  rather
               than down the page.

          -m   Stream output format.

          -l   Lists 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.

          -n   The same as -l, except that the owner's UID and group's
               GID  numbers  are  printed,  rather than the associated
               character strings.

          -o   The same as -l, except that the group is not printed.

          -g   The same as -l, except that the owner is not printed.

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

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

          -u   Uses time of last access instead of  last  modification
               for sorting use with the -t option.

          -c   Uses time of  last  modification  of  the  inode  (file
               created,  mode  changed, etc.)  for sorting use with -t
               option.

          -p   Puts a slash (/) after each filename if that file is  a
               directory.

          -F   Puts a slash (/) after each filename if that file is  a
               directory  and puts an asterisk (*) after each filename
               if that file is executable.

          -b   Forces printing of non-graphic characters to be in  the
               octal \ddd notation.

          -q   Forces printing of non-graphic characters in file names
               as the character (?).

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

          -s   Gives size in blocks, including  indirect  blocks,  for
               each entry.

          -f   Forces each argument to be interpreted as  a  directory
               and  lists  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.

          The  mode  printed  under  the  -l  option  consists  of  11
          characters.  The first character is:

          -   If the entry is an ordinary file.

          d   If the entry is a directory.

          b   If the entry is a block special file.

          c   If the entry is a character special file.

          p   If the entry is a named pipe.

          s   If the entry is a semaphore.

          m   If the entry is a shared data (memory) file.

          The next 9 characters are interpreted as 3 sets  of  3  bits
          each.   The first set refers to the owner's permissions; the
          next to permissions of others in the user-group of the file;
          and  the  last  to  all  others.   Within  each  set,  the 3
          characters indicate permission to read,  to  write,  and  to
          execute   the  file  as  a  program,  respectively.   For  a
          directory, ``execute'' 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 the indicated permission is not granted.

          The group-execute permission character is given as s if  the
          file  has  set-group-ID  mode;  likewise,  the  user-execute
          permission character is given as s  if  the  file  has  set-
          user-ID mode.  The last character of the mode (normally x or
          -) is t if the 1000 (octal) bit of  the  mode  is  on.   See
          chmod(C)  for the meaning of this mode.  The indications for
          set-ID and the 1000 bit of the mode are capitalized  if  the
          corresponding execute permission is not set.

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


     Files
          /etc/passwd
                  Gets user IDs for ls -l and ls -o

          /etc/group
                  Gets group IDs for ls -l and ls -g

          /etc/termcap
                  Gets terminal information


     See Also
          chmod(C),  coltbl(M),  find(C),  l(C),   lc(C),   locale(M),
          termcap(F)


     Notes
          Sorts according to the collating sequenced  defined  by  the
          locale.

          Newline  and  tab  are  considered  printing  characters  in
          filenames.

          Unprintable characters in filenames may confuse the columnar
          output options.

          This utility reports  sizes  in  512  byte  blocks.   ls  -s
          interprets 1 block from a 1024 byte block system as 2 of its
          own 512 byte blocks.  Thus a 500 byte file is interpreted as
          2 blocks rather than 1.


     Standards Conformance
          ls is conformant with:
          AT&T SVID Issue 2, Select Code 307-127;
          and The X/Open Portability Guide II of January 1987.


     (printed 2/15/90)                                      LS(C)
















































































































































































































































































































































































































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